python/dist/src/Modules structmodule.c,2.61,2.62
Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22138/Modules Modified Files: structmodule.c Log Message: Patch #1011240: SystemError generated by struct.pack('P', 'foo'). Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.61 retrieving revision 2.62 diff -u -d -r2.61 -r2.62 --- structmodule.c 19 Nov 2003 22:52:23 -0000 2.61 +++ structmodule.c 27 Sep 2004 19:27:51 -0000 2.62 @@ -518,14 +518,16 @@ static int np_void_p(char *p, PyObject *v, const formatdef *f) { - void *x = PyLong_AsVoidPtr(v); - if (x == NULL && PyErr_Occurred()) { - /* ### hrm. PyLong_AsVoidPtr raises SystemError */ - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_SetString(StructError, - "required argument is not an integer"); + void *x; + + v = get_pylong(v); + if (v == NULL) + return -1; + assert(PyLong_Check(v)); + x = PyLong_AsVoidPtr(v); + Py_DECREF(v); + if (x == NULL && PyErr_Occurred()) return -1; - } memcpy(p, (char *)&x, sizeof x); return 0; }
participants (1)
-
arigoļ¼ users.sourceforge.net