diff options
author | Thomas Heller <theller@ctypes.org> | 2006-03-16 19:56:24 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-03-16 19:56:24 (GMT) |
commit | aa47570bdf0e584f1e358152e91808c3d2c8623c (patch) | |
tree | c6471bc80d09b591ec1225ebe75ce039b5c23757 | |
parent | b2167614f8c20eacfd6304f85495a884f6435b7b (diff) | |
download | cpython-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.c | 11 |
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): |