summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-11-10 00:39:46 +0100
committerGitHub <noreply@github.com>2020-11-10 00:39:46 +0100
commit1e8fdf27eff0a19a9d68e24973bc76d8a953654a (patch)
tree07e57beeb77941226203700caa0cd0850bf5362e
parent4791b4078666f632d01088fd73b35840d37b1ae5 (diff)
downloadpsutil-1e8fdf27eff0a19a9d68e24973bc76d8a953654a.tar.gz
[Windows] add support for pypy2 on windows (#1872)
-rw-r--r--HISTORY.rst8
-rw-r--r--psutil/_psutil_common.c17
-rw-r--r--psutil/arch/windows/wmi.c2
3 files changed, 22 insertions, 5 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 54f2d79f..8512793b 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -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
=====
diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c
index 4178e0c0..a01919d5 100644
--- a/psutil/_psutil_common.c
+++ b/psutil/_psutil_common.c
@@ -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;
@@ -58,7 +57,17 @@ error:
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)
// ====================================================================
diff --git a/psutil/arch/windows/wmi.c b/psutil/arch/windows/wmi.c
index 0a1fb891..ec5cdeb5 100644
--- a/psutil/arch/windows/wmi.c
+++ b/psutil/arch/windows/wmi.c
@@ -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