[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (G… · python/cpython@48c8bf2
@@ -547,7 +547,7 @@ static PyObject *
547547CDataType_from_address(PyObject *type, PyObject *value)
548548{
549549void *buf;
550-if (!PyInt_Check(value) && !PyLong_Check(value)) {
550+if (!_PyAnyInt_Check(value)) {
551551PyErr_SetString(PyExc_TypeError,
552552"integer expected");
553553return NULL;
@@ -691,7 +691,7 @@ CDataType_in_dll(PyObject *type, PyObject *args)
691691obj = PyObject_GetAttrString(dll, "_handle");
692692if (!obj)
693693return NULL;
694-if (!PyInt_Check(obj) && !PyLong_Check(obj)) {
694+if (!_PyAnyInt_Check(obj)) {
695695PyErr_SetString(PyExc_TypeError,
696696"the _handle attribute of the second argument must be an integer");
697697Py_DECREF(obj);
@@ -1779,7 +1779,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
17791779 }
17801780/* Should probably allow buffer interface as well */
17811781/* int, long */
1782-if (PyInt_Check(value) || PyLong_Check(value)) {
1782+if (_PyAnyInt_Check(value)) {
17831783PyCArgObject *parg;
17841784struct fielddesc *fd = _ctypes_get_fielddesc("P");
17851785@@ -3419,7 +3419,7 @@ static int
34193419_get_name(PyObject *obj, char **pname)
34203420{
34213421#ifdef MS_WIN32
3422-if (PyInt_Check(obj) || PyLong_Check(obj)) {
3422+if (_PyAnyInt_Check(obj)) {
34233423/* We have to use MAKEINTRESOURCEA for Windows CE.
34243424 Works on Windows as well, of course.
34253425 */
@@ -3469,7 +3469,7 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
34693469Py_DECREF(ftuple);
34703470return NULL;
34713471 }
3472-if (!PyInt_Check(obj) && !PyLong_Check(obj)) {
3472+if (!_PyAnyInt_Check(obj)) {
34733473PyErr_SetString(PyExc_TypeError,
34743474"the _handle attribute of the second argument must be an integer");
34753475Py_DECREF(ftuple);
@@ -3600,8 +3600,7 @@ PyCFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
36003600#endif
3601360136023602if (1 == PyTuple_GET_SIZE(args)
3603-&& (PyInt_Check(PyTuple_GET_ITEM(args, 0))
3604-|| PyLong_Check(PyTuple_GET_ITEM(args, 0)))) {
3603+&& _PyAnyInt_Check(PyTuple_GET_ITEM(args, 0))) {
36053604CDataObject *ob;
36063605void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0));
36073606if (ptr == NULL && PyErr_Occurred())