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

[Windows] add support for pypy2 on windows #1872

Merged
merged 2 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ XXXX-XX-XX

**Enhancements**

- 1875_: `disk_partitions()` exposes 2 extra fields: `maxfile` and `maxpath`,
- 1872_: [Windows] added support for PyPy 2.7.
- 1863_: `disk_partitions()` exposes 2 extra fields: `maxfile` and `maxpath`,
which are the maximum file name and path name length.

**Bug fixes**

- 1866_: [Windows] process exe(), cmdline(), environ() may raise "invalid
access to memory location" on Python 3.9.

5.7.3
=====

Expand Down
17 changes: 13 additions & 4 deletions psutil/_psutil_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ int PSUTIL_TESTING = 0;
// ====================================================================

// PyPy on Windows
#if defined(PSUTIL_WINDOWS) && \
defined(PYPY_VERSION) && \
!defined(PyErr_SetFromWindowsErrWithFilename)
#if defined(PSUTIL_WINDOWS) && defined(PYPY_VERSION)
#if !defined(PyErr_SetFromWindowsErrWithFilename)
PyObject *
PyErr_SetFromWindowsErrWithFilename(int winerr, const char *filename) {
PyObject *py_exc = NULL;
Expand Down Expand Up @@ -58,7 +57,17 @@ PyErr_SetFromWindowsErrWithFilename(int winerr, const char *filename) {
Py_XDECREF(py_winerr);
return NULL;
}
#endif // PYPY on Windows
#endif // !defined(PyErr_SetFromWindowsErrWithFilename)


// PyPy 2.7
#if !defined(PyErr_SetFromWindowsErr)
PyObject *
PyErr_SetFromWindowsErr(int winerr) {
return PyErr_SetFromWindowsErrWithFilename(winerr, "");
}
#endif // !defined(PyErr_SetFromWindowsErr)
#endif // defined(PSUTIL_WINDOWS) && defined(PYPY_VERSION)


// ====================================================================
Expand Down
2 changes: 2 additions & 0 deletions psutil/arch/windows/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <windows.h>
#include <pdh.h>

#include "../../_psutil_common.h"


// We use an exponentially weighted moving average, just like Unix systems do
// https://en.wikipedia.org/wiki/Load_(computing)#Unix-style_load_calculation
Expand Down