summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-10-27 16:12:53 (GMT)
committerGitHub <noreply@github.com>2020-10-27 16:12:53 (GMT)
commit37834136d0afe51d274bfc79d8705514cbe73727 (patch)
tree0e4c6b1f42813363f690e7ad179874d727d2cd79 /Modules/_ctypes
parenta6879d9445f98833c4e300e187956e2a218a2315 (diff)
downloadcpython-37834136d0afe51d274bfc79d8705514cbe73727.zip
cpython-37834136d0afe51d274bfc79d8705514cbe73727.tar.gz
cpython-37834136d0afe51d274bfc79d8705514cbe73727.tar.bz2
bpo-42161: Modules/ uses _PyLong_GetZero() and _PyLong_GetOne() (GH-22998)
Use _PyLong_GetZero() and _PyLong_GetOne() in Modules/ directory. _cursesmodule.c and zoneinfo.c are now built with Py_BUILD_CORE_MODULE macro defined.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/_ctypes.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 9be90eb..8d5594c 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -116,6 +116,8 @@ bytes(cdata)
#endif
#include "ctypes.h"
+#include "pycore_long.h" // _PyLong_GetZero()
+
PyObject *PyExc_ArgError = NULL;
/* This dict maps ctypes types to POINTER types */
@@ -3929,8 +3931,9 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes,
case PARAMFLAG_FIN | PARAMFLAG_FLCID:
/* ['in', 'lcid'] parameter. Always taken from defval,
if given, else the integer 0. */
- if (defval == NULL)
- defval = _PyLong_Zero;
+ if (defval == NULL) {
+ defval = _PyLong_GetZero();
+ }
Py_INCREF(defval);
PyTuple_SET_ITEM(callargs, i, defval);
break;