[Python-checkins] python/dist/src/Modules _testcapimodule.c,1.22,1.23
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Mon, 21 Apr 2003 18:29:01 -0700
- Previous message: [Python-checkins] python/dist/src/Lib trace.py,1.4,1.5
- Next message: [Python-checkins] python/dist/src/PC/os2emx dlfcn.c,1.1,1.2 dlfcn.h,1.1,1.2 dllentry.c,1.3,1.4 getpathp.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv27510/Modules
Modified Files:
_testcapimodule.c
Log Message:
Get test_capi & test_getargs2 to pass on alphas
* UINT_MAX -> ULONG_MAX since we are dealing with longs
* ParseTuple needs &int for 'i' and &long for 'l'
There may be a better way to do this, but this works.
Index: _testcapimodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** _testcapimodule.c 19 Apr 2003 15:41:47 -0000 1.22
--- _testcapimodule.c 22 Apr 2003 01:28:57 -0000 1.23
***************
*** 320,324 ****
PyObject *ob, *result = NULL, *argtuple;
char *fmt;
- long value = 0;
if (!PyArg_ParseTuple(args, "sO", &fmt, &ob))
--- 320,323 ----
***************
*** 327,332 ****
Py_INCREF(ob);
PyTuple_SET_ITEM(argtuple, 0, ob);
! if (PyArg_ParseTuple(argtuple, fmt, &value))
! result = PyLong_FromLong(value);
Py_DECREF(argtuple);
return result;
--- 326,345 ----
Py_INCREF(ob);
PyTuple_SET_ITEM(argtuple, 0, ob);
! /* It's necessary to distinguish between ints and longs, since
! sizeof(int) != sizeof(long) on some (64 bit) platforms.
! value must be an int for: PyArg_ParseTuple(t, 'i', &value)
! value must be an long for: PyArg_ParseTuple(t, 'l', &value)
! */
! if (*fmt == 'i') {
! int value;
! if (PyArg_ParseTuple(argtuple, fmt, &value))
! result = PyLong_FromLong(value);
! } else if (*fmt == 'l') {
! long value;
! if (PyArg_ParseTuple(argtuple, fmt, &value))
! result = PyLong_FromLong(value);
! } else {
! PyErr_SetString(PyExc_TypeError, "format was not i or l");
! }
Py_DECREF(argtuple);
return result;
***************
*** 385,389 ****
return NULL;
! /* a number larger than UINT_MAX even on 64-bit platforms */
num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16);
if (num == NULL)
--- 398,402 ----
return NULL;
! /* a number larger than ULONG_MAX even on 64-bit platforms */
num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16);
if (num == NULL)
***************
*** 391,395 ****
value = PyInt_AsUnsignedLongMask(num);
! if (value != UINT_MAX)
return raiseTestError("test_k_code",
"PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");
--- 404,408 ----
value = PyInt_AsUnsignedLongMask(num);
! if (value != ULONG_MAX)
return raiseTestError("test_k_code",
"PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");
***************
*** 400,404 ****
if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0)
return NULL;
! if (value != UINT_MAX)
return raiseTestError("test_k_code",
"k code returned wrong value for long 0xFFF...FFF");
--- 413,417 ----
if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0)
return NULL;
! if (value != ULONG_MAX)
return raiseTestError("test_k_code",
"k code returned wrong value for long 0xFFF...FFF");
- Previous message: [Python-checkins] python/dist/src/Lib trace.py,1.4,1.5
- Next message: [Python-checkins] python/dist/src/PC/os2emx dlfcn.c,1.1,1.2 dlfcn.h,1.1,1.2 dllentry.c,1.3,1.4 getpathp.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]