[Python-checkins] CVS: python/dist/src/Modules _testcapimodule.c,1.7,1.8 testcapi_long.h,1.1,1.2
Tim Peters
tim_one@users.sourceforge.net
Sat, 16 Jun 2001 01:10:15 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv12541/python/dist/src/Modules
Modified Files:
_testcapimodule.c testcapi_long.h
Log Message:
Fix error in comment, and in test_long_api and test_longlong_api remove
the need for the F_ERROR macro.
Index: _testcapimodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** _testcapimodule.c 2001/06/14 01:11:03 1.7
--- _testcapimodule.c 2001/06/16 08:10:13 1.8
***************
*** 203,207 ****
#define F_U_TO_PY PyLong_FromUnsignedLong
#define F_PY_TO_U PyLong_AsUnsignedLong
- #define F_ERROR raise_test_long_error
#include "testcapi_long.h"
--- 203,206 ----
***************
*** 213,217 ****
return NULL;
! return TESTNAME();
}
--- 212,216 ----
return NULL;
! return TESTNAME(raise_test_long_error);
}
***************
*** 222,226 ****
#undef F_U_TO_PY
#undef F_PY_TO_U
- #undef F_ERROR
#ifdef HAVE_LONG_LONG
--- 221,224 ----
***************
*** 238,242 ****
#define F_U_TO_PY PyLong_FromUnsignedLongLong
#define F_PY_TO_U PyLong_AsUnsignedLongLong
- #define F_ERROR raise_test_longlong_error
#include "testcapi_long.h"
--- 236,239 ----
***************
*** 248,252 ****
return NULL;
! return TESTNAME();
}
--- 245,249 ----
return NULL;
! return TESTNAME(raise_test_longlong_error);
}
***************
*** 257,261 ****
#undef F_U_TO_PY
#undef F_PY_TO_U
- #undef F_ERROR
#endif /* ifdef HAVE_LONG_LONG */
--- 254,257 ----
Index: testcapi_long.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/testcapi_long.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** testcapi_long.h 2001/06/14 00:55:41 1.1
--- testcapi_long.h 2001/06/16 08:10:13 1.2
***************
*** 5,14 ****
F_PY_TO_S convert pylong to signed; PyObject* -> TYPENAME
F_U_TO_PY convert unsigned to pylong; unsigned TYPENAME -> PyObject*
! F_PY_TO_U convert pylong to unsigned; PyObject* -> TypeError
! F_ERROR error-report function; char* -> PyObject* (returns NULL)
*/
static PyObject *
! TESTNAME()
{
const int NBITS = sizeof(TYPENAME) * 8;
--- 5,13 ----
F_PY_TO_S convert pylong to signed; PyObject* -> TYPENAME
F_U_TO_PY convert unsigned to pylong; unsigned TYPENAME -> PyObject*
! F_PY_TO_U convert pylong to unsigned; PyObject* -> unsigned TYPENAME
*/
static PyObject *
! TESTNAME(PyObject *error(const char*))
{
const int NBITS = sizeof(TYPENAME) * 8;
***************
*** 46,58 ****
pyresult = F_U_TO_PY(uin);
if (pyresult == NULL)
! return F_ERROR(
"unsigned unexpected null result");
uout = F_PY_TO_U(pyresult);
if (uout == (unsigned TYPENAME)-1 && PyErr_Occurred())
! return F_ERROR(
"unsigned unexpected -1 result");
if (uout != uin)
! return F_ERROR(
"unsigned output != input");
UNBIND(pyresult);
--- 45,57 ----
pyresult = F_U_TO_PY(uin);
if (pyresult == NULL)
! return error(
"unsigned unexpected null result");
uout = F_PY_TO_U(pyresult);
if (uout == (unsigned TYPENAME)-1 && PyErr_Occurred())
! return error(
"unsigned unexpected -1 result");
if (uout != uin)
! return error(
"unsigned output != input");
UNBIND(pyresult);
***************
*** 61,73 ****
pyresult = F_S_TO_PY(in);
if (pyresult == NULL)
! return F_ERROR(
"signed unexpected null result");
out = F_PY_TO_S(pyresult);
if (out == (TYPENAME)-1 && PyErr_Occurred())
! return F_ERROR(
"signed unexpected -1 result");
if (out != in)
! return F_ERROR(
"signed output != input");
UNBIND(pyresult);
--- 60,72 ----
pyresult = F_S_TO_PY(in);
if (pyresult == NULL)
! return error(
"signed unexpected null result");
out = F_PY_TO_S(pyresult);
if (out == (TYPENAME)-1 && PyErr_Occurred())
! return error(
"signed unexpected -1 result");
if (out != in)
! return error(
"signed output != input");
UNBIND(pyresult);
***************
*** 86,90 ****
one = PyLong_FromLong(1);
if (one == NULL)
! return F_ERROR(
"unexpected NULL from PyLong_FromLong");
--- 85,89 ----
one = PyLong_FromLong(1);
if (one == NULL)
! return error(
"unexpected NULL from PyLong_FromLong");
***************
*** 92,101 ****
x = PyNumber_Negative(one);
if (x == NULL)
! return F_ERROR(
"unexpected NULL from PyNumber_Negative");
uout = F_PY_TO_U(x);
if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
! return F_ERROR(
"PyLong_AsUnsignedXXX(-1) didn't complain");
PyErr_Clear();
--- 91,100 ----
x = PyNumber_Negative(one);
if (x == NULL)
! return error(
"unexpected NULL from PyNumber_Negative");
uout = F_PY_TO_U(x);
if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
! return error(
"PyLong_AsUnsignedXXX(-1) didn't complain");
PyErr_Clear();
***************
*** 105,109 ****
y = PyLong_FromLong((long)NBITS);
if (y == NULL)
! return F_ERROR(
"unexpected NULL from PyLong_FromLong");
--- 104,108 ----
y = PyLong_FromLong((long)NBITS);
if (y == NULL)
! return error(
"unexpected NULL from PyLong_FromLong");
***************
*** 111,120 ****
UNBIND(y);
if (x == NULL)
! return F_ERROR(
"unexpected NULL from PyNumber_Lshift");
uout = F_PY_TO_U(x);
if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
! return F_ERROR(
"PyLong_AsUnsignedXXX(2**NBITS) didn't "
"complain");
--- 110,119 ----
UNBIND(y);
if (x == NULL)
! return error(
"unexpected NULL from PyNumber_Lshift");
uout = F_PY_TO_U(x);
if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
! return error(
"PyLong_AsUnsignedXXX(2**NBITS) didn't "
"complain");
***************
*** 126,135 ****
UNBIND(x);
if (y == NULL)
! return F_ERROR(
"unexpected NULL from PyNumber_Rshift");
out = F_PY_TO_S(y);
if (out != (TYPENAME)-1 || !PyErr_Occurred())
! return F_ERROR(
"PyLong_AsXXX(2**(NBITS-1)) didn't "
"complain");
--- 125,134 ----
UNBIND(x);
if (y == NULL)
! return error(
"unexpected NULL from PyNumber_Rshift");
out = F_PY_TO_S(y);
if (out != (TYPENAME)-1 || !PyErr_Occurred())
! return error(
"PyLong_AsXXX(2**(NBITS-1)) didn't "
"complain");
***************
*** 141,145 ****
UNBIND(y);
if (x == NULL)
! return F_ERROR(
"unexpected NULL from PyNumber_Negative");
--- 140,144 ----
UNBIND(y);
if (x == NULL)
! return error(
"unexpected NULL from PyNumber_Negative");
***************
*** 147,156 ****
UNBIND(x);
if (y == NULL)
! return F_ERROR(
"unexpected NULL from PyNumber_Subtract");
out = F_PY_TO_S(y);
if (out != (TYPENAME)-1 || !PyErr_Occurred())
! return F_ERROR(
"PyLong_AsXXX(-2**(NBITS-1)-1) didn't "
"complain");
--- 146,155 ----
UNBIND(x);
if (y == NULL)
! return error(
"unexpected NULL from PyNumber_Subtract");
out = F_PY_TO_S(y);
if (out != (TYPENAME)-1 || !PyErr_Occurred())
! return error(
"PyLong_AsXXX(-2**(NBITS-1)-1) didn't "
"complain");