summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-03-16 19:56:24 (GMT)
committerThomas Heller <theller@ctypes.org>2006-03-16 19:56:24 (GMT)
commitaa47570bdf0e584f1e358152e91808c3d2c8623c (patch)
treec6471bc80d09b591ec1225ebe75ce039b5c23757
parentb2167614f8c20eacfd6304f85495a884f6435b7b (diff)
downloadcpython-aa47570bdf0e584f1e358152e91808c3d2c8623c.zip
cpython-aa47570bdf0e584f1e358152e91808c3d2c8623c.tar.gz
cpython-aa47570bdf0e584f1e358152e91808c3d2c8623c.tar.bz2
Use int 0 as default defval for LCID if nothing has been supplied.
-rw-r--r--Modules/_ctypes/_ctypes.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 6ee815c..604c590 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2840,9 +2840,14 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
switch (flag & (PARAMFLAG_FIN | PARAMFLAG_FOUT | PARAMFLAG_FLCID)) {
case PARAMFLAG_FIN | PARAMFLAG_FLCID:
- /* ['in', 'lcid'] parameter. Always taken from defval */
- assert(defval);
- Py_INCREF(defval);
+ /* ['in', 'lcid'] parameter. Always taken from defval,
+ if given, else the integer 0. */
+ if (defval == NULL) {
+ defval = PyInt_FromLong(0);
+ if (defval == NULL)
+ goto error;
+ } else
+ Py_INCREF(defval);
PyTuple_SET_ITEM(callargs, i, defval);
break;
case (PARAMFLAG_FIN | PARAMFLAG_FOUT):