Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Python 2.7 support #2481

Merged
merged 82 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7c274a4
port setup.py
giampaolo Dec 18, 2024
c48d3c5
assume enum always exist
giampaolo Dec 18, 2024
c79b6b4
rm `from psutil.tests import mock`
giampaolo Dec 18, 2024
a71e88d
import ipaddress directly
giampaolo Dec 18, 2024
abfb67f
remove raise_from() wrapper
giampaolo Dec 18, 2024
3479b0c
rm `if PY3` logic from _aix.py
giampaolo Dec 18, 2024
a7fed78
rm `if PY3` logic from _pslinux.py
giampaolo Dec 18, 2024
e8061da
rm py2 unicode wrapper around disk_usage()
giampaolo Dec 18, 2024
a428016
rm `if PY3` logic from _pssunos.py
giampaolo Dec 18, 2024
d8dd607
adjust test/__init__.py and test/test_windows.py
giampaolo Dec 18, 2024
0f7d25b
address io.StringIO
giampaolo Dec 18, 2024
2686c8a
rm other PY3 occurrences
giampaolo Dec 18, 2024
c5f2ac1
remove appveyor + py2 CI tests
giampaolo Dec 18, 2024
9c5f455
rm other PY3 occurrences
giampaolo Dec 18, 2024
06253c2
adjust mock.patch("builtins.open", ...)
giampaolo Dec 18, 2024
2dbf1c8
adjust test/test_linux.py
giampaolo Dec 18, 2024
03bfa06
make build: always use --parallel N option
giampaolo Dec 18, 2024
30952bf
adjust _pswindows.py
giampaolo Dec 18, 2024
c7567d2
get rid of long
giampaolo Dec 18, 2024
5abd217
get rid of range / xrange
giampaolo Dec 18, 2024
8470427
get rid of unicode
giampaolo Dec 18, 2024
e3b76fc
get rid of basestring
giampaolo Dec 18, 2024
411f386
get rid of b() literal
giampaolo Dec 18, 2024
e4a348b
get rid of super()
giampaolo Dec 18, 2024
8ed58ea
rm builtin exceptions
giampaolo Dec 18, 2024
6c982f5
rm functools.lru_cache()
giampaolo Dec 18, 2024
421d5df
rm shutil.which()
giampaolo Dec 18, 2024
b900695
rm shutil.get_terminal_size()
giampaolo Dec 18, 2024
726e415
rm subprocess.TimeoutExpired
giampaolo Dec 18, 2024
72b9f55
rm contextlib.redirect_stderr()
giampaolo Dec 18, 2024
83e096a
delete _compat.py - this module was 15 years old, added in 5bab8cdd4
giampaolo Dec 18, 2024
4db1d07
rm contextlib.closing()
giampaolo Dec 18, 2024
7715d0c
rm python 2.7 compatibility requires no comma
giampaolo Dec 18, 2024
2af9f65
WindowsError.winerror should always be present in python 3
giampaolo Dec 18, 2024
01381b6
rm prlimit() hack based on ctypes
giampaolo Dec 18, 2024
28cb0cb
rm comments & docstrings about python 2
giampaolo Dec 18, 2024
5deeb2d
rm python 2 from setup.py metadata
giampaolo Dec 18, 2024
e35318e
update README and comments / docstrings about python 2
giampaolo Dec 18, 2024
6d28d58
remove importlib wrappers
giampaolo Dec 18, 2024
bcfbfc1
rm references to sys.version_info
giampaolo Dec 18, 2024
856e831
remove further 2.7 references from internal scripts
giampaolo Dec 18, 2024
4612b86
rm `from __future__ import` and utf8 shebang
giampaolo Dec 18, 2024
7892daf
fix build.yml
giampaolo Dec 18, 2024
de16ba3
fix winmake.py test-parallel
giampaolo Dec 18, 2024
a7caf3a
fix winmake.py test-parallel
giampaolo Dec 18, 2024
ba2111e
replace IOError and EnvironmentError with OSError (they are both alia…
giampaolo Dec 18, 2024
3bf7a9f
Merge branch 'rm-py2-2' into rm-py2
giampaolo Dec 18, 2024
4cba2d8
run pyupgrade to modernize code
giampaolo Dec 18, 2024
e789bf1
use list.copy() instead of list[:]
giampaolo Dec 18, 2024
ac56cbb
use f-string instead of str.format()
giampaolo Dec 18, 2024
d11448c
remove _compat.py refs
giampaolo Dec 18, 2024
2bc1738
merge from master
giampaolo Dec 18, 2024
c3dce20
update doc
giampaolo Dec 18, 2024
706383e
replace WindowsError with OSError
giampaolo Dec 18, 2024
22d0bfe
rm backport of PyErr_SetFromWindowsErr on PYPY 2.7
giampaolo Dec 18, 2024
b2065af
small refact
giampaolo Dec 19, 2024
24cfdbd
disable flaky test
giampaolo Dec 19, 2024
50297f0
adjust PyInit for linux
giampaolo Dec 19, 2024
c1d2d66
merge from master
giampaolo Dec 19, 2024
96e873d
adjust PyInit for _psutil_posix.c
giampaolo Dec 19, 2024
6d99c46
try to adjust WindowsError.winerror
giampaolo Dec 19, 2024
756d2f4
rm worarounds for missing PyUnicode_DecodeFS on py2
giampaolo Dec 19, 2024
be74133
adjust PyLong_FromPid
giampaolo Dec 19, 2024
976b27e
adjust PyInit for _psutil_bsd.c
giampaolo Dec 19, 2024
046b014
adjust PyInit for _psutil_osx.c
giampaolo Dec 19, 2024
196f0c7
adjust PyInit for _psutil_windows.c
giampaolo Dec 19, 2024
3bbfe69
unify PyInt_FromLong
giampaolo Dec 19, 2024
8d7bd96
rm py2 C handling of disk_usage() on windows
giampaolo Dec 19, 2024
d77664c
adjust PyInit for _psutil_aix.c
giampaolo Dec 19, 2024
6843ee1
adjust PyInit for _psutil_sunosù.c
giampaolo Dec 19, 2024
b31f9b2
rm py2 comments + small refact
giampaolo Dec 19, 2024
0b7bfb8
update doc
giampaolo Dec 19, 2024
b438d68
merge from master
giampaolo Dec 19, 2024
0ad0b4b
merge from master
giampaolo Dec 19, 2024
e7cf363
merge from master
giampaolo Dec 19, 2024
6b18b17
Popen: better exception msg on AttributeError
giampaolo Dec 19, 2024
74f9b36
make setup.py print last psutil version supporting Python 2.7
giampaolo Dec 20, 2024
85a5a7d
update doc
giampaolo Dec 20, 2024
615fc0e
revert nice __getattr__ / raise x from None change. Let's keep the py…
giampaolo Dec 20, 2024
fdc14e4
update build.yml
giampaolo Dec 20, 2024
161ce41
rename download_wheels_github.py -> download_wheels.py
giampaolo Dec 20, 2024
4c09586
update doc
giampaolo Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adjust PyInit for _psutil_bsd.c
  • Loading branch information
giampaolo committed Dec 19, 2024
commit 976b27eeb761ca0f3177c2d9326a3ed1f282f7d3
46 changes: 18 additions & 28 deletions psutil/_psutil_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
#endif


#define INITERR return NULL


/*
* define the psutil C module methods and initialize the module.
*/
Expand Down Expand Up @@ -112,34 +115,23 @@ static PyMethodDef mod_methods[] = {
{NULL, NULL, 0, NULL}
};

#if PY_MAJOR_VERSION >= 3
#define INITERR return NULL

static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_psutil_bsd",
NULL,
-1,
mod_methods,
NULL,
NULL,
NULL,
NULL
};

PyObject *PyInit__psutil_bsd(void)
#else /* PY_MAJOR_VERSION */
#define INITERR return

void init_psutil_bsd(void)
#endif /* PY_MAJOR_VERSION */
{

static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_psutil_bsd",
NULL,
-1,
mod_methods,
NULL,
NULL,
NULL,
NULL
};

PyObject
*PyInit__psutil_bsd(void) {
PyObject *v;
#if PY_MAJOR_VERSION >= 3
PyObject *mod = PyModule_Create(&moduledef);
#else
PyObject *mod = Py_InitModule("_psutil_bsd", mod_methods);
#endif
if (mod == NULL)
INITERR;

Expand Down Expand Up @@ -210,7 +202,5 @@ static PyMethodDef mod_methods[] = {

if (mod == NULL)
INITERR;
#if PY_MAJOR_VERSION >= 3
return mod;
#endif
}