diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-25 19:32:24 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-25 19:32:24 +0100 |
commit | d6ff1e0c1c16f244971fd27a31a3929c5ad192eb (patch) | |
tree | 030de56b3801e069bafe607e9a58de29f97cb8f8 | |
parent | 454b6978446e6de2a50a8ce7beb051adb99d4236 (diff) | |
download | psutil-d6ff1e0c1c16f244971fd27a31a3929c5ad192eb.tar.gz |
refactoring
-rw-r--r-- | psutil/_psutil_common.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/psutil/_psutil_common.h b/psutil/_psutil_common.h index 27d4c3c0..d45cf56b 100644 --- a/psutil/_psutil_common.h +++ b/psutil/_psutil_common.h @@ -29,13 +29,15 @@ static const int PSUTIL_CONN_NONE = 128; #define SIZEOF_PID_T SIZEOF_INT #endif -// _Py_PARSE_PID is Python 3 only, but since it's private make sure it's -// always present. -#ifndef _Py_PARSE_PID +#if !defined(_Py_PARSE_PID) || PY_MAJOR_VERSION < 3 #if !defined(SIZEOF_PID_T) || !defined(SIZEOF_INT) || !defined(SIZEOF_LONG) #error "missing SIZEOF* definition" #endif +#endif +// _Py_PARSE_PID is Python 3 only, but since it's private make sure it's +// always present. +#ifndef _Py_PARSE_PID #if SIZEOF_PID_T == SIZEOF_INT #define _Py_PARSE_PID "i" #elif SIZEOF_PID_T == SIZEOF_LONG @@ -49,13 +51,7 @@ static const int PSUTIL_CONN_NONE = 128; #endif #if PY_MAJOR_VERSION < 3 - #if !defined(SIZEOF_PID_T) || !defined(SIZEOF_INT) || !defined(SIZEOF_LONG) - #error "missing SIZEOF* definition" - #endif - - #if SIZEOF_PID_T == SIZEOF_INT - #define PyLong_FromPid PyInt_FromLong - #elif SIZEOF_PID_T == SIZEOF_LONG + #if ((SIZEOF_PID_T == SIZEOF_INT) || (SIZEOF_PID_T == SIZEOF_LONG)) #define PyLong_FromPid PyInt_FromLong #elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG #define PyLong_FromPid PyLong_FromLongLong |