| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 083bea4 commit e1a0d11
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -236,7 +236,7 @@ static PyObject * | |||
| 236 | 236 | CDataType_from_address(PyObject *type, PyObject *value) | |
| 237 | 237 | { | |
| 238 | 238 | void *buf; | |
| 239 | - if (!PyInt_Check(value) && !PyLong_Check(value)) { | ||
| 239 | + if (!PyInt_Check(value)) { | ||
| 240 | 240 | PyErr_SetString(PyExc_TypeError, | |
| 241 | 241 | "integer expected"); | |
| 242 | 242 | return NULL; | |
@@ -265,7 +265,7 @@ CDataType_in_dll(PyObject *type, PyObject *args) | |||
| 265 | 265 | obj = PyObject_GetAttrString(dll, "_handle"); | |
| 266 | 266 | if (!obj) | |
| 267 | 267 | return NULL; | |
| 268 | - if (!PyInt_Check(obj) && !PyLong_Check(obj)) { | ||
| 268 | + if (!PyInt_Check(obj)) { | ||
| 269 | 269 | PyErr_SetString(PyExc_TypeError, | |
| 270 | 270 | "the _handle attribute of the second argument must be an integer"); | |
| 271 | 271 | Py_DECREF(obj); | |
@@ -1233,7 +1233,7 @@ c_void_p_from_param(PyObject *type, PyObject *value) | |||
| 1233 | 1233 | } | |
| 1234 | 1234 | /* Should probably allow buffer interface as well */ | |
| 1235 | 1235 | /* int, long */ | |
| 1236 | - if (PyInt_Check(value) || PyLong_Check(value)) { | ||
| 1236 | + if (PyInt_Check(value)) { | ||
| 1237 | 1237 | PyCArgObject *parg; | |
| 1238 | 1238 | struct fielddesc *fd = getentry("P"); | |
| 1239 | 1239 | ||
@@ -2697,7 +2697,7 @@ static int | |||
| 2697 | 2697 | _get_name(PyObject *obj, char **pname) | |
| 2698 | 2698 | { | |
| 2699 | 2699 | #ifdef MS_WIN32 | |
| 2700 | - if (PyInt_Check(obj) || PyLong_Check(obj)) { | ||
| 2700 | + if (PyInt_Check(obj)) { | ||
| 2701 | 2701 | /* We have to use MAKEINTRESOURCEA for Windows CE. | |
| 2702 | 2702 | Works on Windows as well, of course. | |
| 2703 | 2703 | */ | |
@@ -2734,7 +2734,7 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
| 2734 | 2734 | obj = PyObject_GetAttrString(dll, "_handle"); | |
| 2735 | 2735 | if (!obj) | |
| 2736 | 2736 | return NULL; | |
| 2737 | - if (!PyInt_Check(obj) && !PyLong_Check(obj)) { | ||
| 2737 | + if (!PyInt_Check(obj)) { | ||
| 2738 | 2738 | PyErr_SetString(PyExc_TypeError, | |
| 2739 | 2739 | "the _handle attribute of the second argument must be an integer"); | |
| 2740 | 2740 | Py_DECREF(obj); | |
@@ -2859,8 +2859,7 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
| 2859 | 2859 | #endif | |
| 2860 | 2860 | ||
| 2861 | 2861 | if (1 == PyTuple_GET_SIZE(args) | |
| 2862 | - && (PyInt_Check(PyTuple_GET_ITEM(args, 0)) | ||
| 2863 | - || PyLong_Check(PyTuple_GET_ITEM(args, 0)))) { | ||
| 2862 | + && (PyInt_Check(PyTuple_GET_ITEM(args, 0)))) { | ||
| 2864 | 2863 | CDataObject *ob; | |
| 2865 | 2864 | void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0)); | |
| 2866 | 2865 | if (ptr == NULL) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -329,7 +329,7 @@ static int | |||
| 329 | 329 | get_long(PyObject *v, long *p) | |
| 330 | 330 | { | |
| 331 | 331 | long x; | |
| 332 | - if (!PyInt_Check(v) && !PyLong_Check(v)) { | ||
| 332 | + if (!PyInt_Check(v)) { | ||
| 333 | 333 | PyErr_Format(PyExc_TypeError, | |
| 334 | 334 | "int expected instead of %s instance", | |
| 335 | 335 | v->ob_type->tp_name); | |
@@ -348,7 +348,7 @@ static int | |||
| 348 | 348 | get_ulong(PyObject *v, unsigned long *p) | |
| 349 | 349 | { | |
| 350 | 350 | unsigned long x; | |
| 351 | - if (!PyInt_Check(v) && !PyLong_Check(v)) { | ||
| 351 | + if (!PyInt_Check(v)) { | ||
| 352 | 352 | PyErr_Format(PyExc_TypeError, | |
| 353 | 353 | "int expected instead of %s instance", | |
| 354 | 354 | v->ob_type->tp_name); | |
@@ -369,7 +369,7 @@ static int | |||
| 369 | 369 | get_longlong(PyObject *v, PY_LONG_LONG *p) | |
| 370 | 370 | { | |
| 371 | 371 | PY_LONG_LONG x; | |
| 372 | - if (!PyInt_Check(v) && !PyLong_Check(v)) { | ||
| 372 | + if (!PyInt_Check(v)) { | ||
| 373 | 373 | PyErr_Format(PyExc_TypeError, | |
| 374 | 374 | "int expected instead of %s instance", | |
| 375 | 375 | v->ob_type->tp_name); | |
@@ -388,7 +388,7 @@ static int | |||
| 388 | 388 | get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) | |
| 389 | 389 | { | |
| 390 | 390 | unsigned PY_LONG_LONG x; | |
| 391 | - if (!PyInt_Check(v) && !PyLong_Check(v)) { | ||
| 391 | + if (!PyInt_Check(v)) { | ||
| 392 | 392 | PyErr_Format(PyExc_TypeError, | |
| 393 | 393 | "int expected instead of %s instance", | |
| 394 | 394 | v->ob_type->tp_name); | |
@@ -1373,7 +1373,7 @@ z_set(void *ptr, PyObject *value, Py_ssize_t size) | |||
| 1373 | 1373 | assert(PyBytes_Check(str)); | |
| 1374 | 1374 | *(char **)ptr = PyBytes_AS_STRING(str); | |
| 1375 | 1375 | return str; | |
| 1376 | - } else if (PyInt_Check(value) || PyLong_Check(value)) { | ||
| 1376 | + } else if (PyInt_Check(value)) { | ||
| 1377 | 1377 | #if SIZEOF_VOID_P == SIZEOF_LONG_LONG | |
| 1378 | 1378 | *(char **)ptr = (char *)PyInt_AsUnsignedLongLongMask(value); | |
| 1379 | 1379 | #else | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,12 +76,7 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx) | |||
| 76 | 76 | ||
| 77 | 77 | PyObject* item; | |
| 78 | 78 | ||
| 79 | - if (PyInt_Check(idx)) { | ||
| 80 | - _idx = PyInt_AsLong(idx); | ||
| 81 | - item = PyTuple_GetItem(self->data, _idx); | ||
| 82 | - Py_XINCREF(item); | ||
| 83 | - return item; | ||
| 84 | - } else if (PyLong_Check(idx)) { | ||
| 79 | + if (PyLong_Check(idx)) { | ||
| 85 | 80 | _idx = PyLong_AsLong(idx); | |
| 86 | 81 | item = PyTuple_GetItem(self->data, _idx); | |
| 87 | 82 | Py_XINCREF(item); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,9 +80,10 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con | |||
| 80 | 80 | int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter) | |
| 81 | 81 | { | |
| 82 | 82 | int rc = SQLITE_OK; | |
| 83 | - long longval; | ||
| 84 | 83 | #ifdef HAVE_LONG_LONG | |
| 85 | 84 | PY_LONG_LONG longlongval; | |
| 85 | + #else | ||
| 86 | + long longval; | ||
| 86 | 87 | #endif | |
| 87 | 88 | const char* buffer; | |
| 88 | 89 | char* string; | |
@@ -91,14 +92,16 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec | |||
| 91 | 92 | ||
| 92 | 93 | if (parameter == Py_None) { | |
| 93 | 94 | rc = sqlite3_bind_null(self->st, pos); | |
| 94 | - } else if (PyInt_CheckExact(parameter)) { | ||
| 95 | - longval = PyInt_AsLong(parameter); | ||
| 96 | - rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval); | ||
| 97 | 95 | #ifdef HAVE_LONG_LONG | |
| 98 | 96 | } else if (PyLong_Check(parameter)) { | |
| 99 | 97 | longlongval = PyLong_AsLongLong(parameter); | |
| 100 | 98 | /* in the overflow error case, longlongval is -1, and an exception is set */ | |
| 101 | 99 | rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longlongval); | |
| 100 | + #else | ||
| 101 | + } else if (PyLong_Check(parameter)) { | ||
| 102 | + longval = PyLong_AsLong(parameter); | ||
| 103 | + /* in the overflow error case, longval is -1, and an exception is set */ | ||
| 104 | + rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval); | ||
| 102 | 105 | #endif | |
| 103 | 106 | } else if (PyFloat_Check(parameter)) { | |
| 104 | 107 | rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -313,8 +313,7 @@ multibytecodec_encerror(MultibyteCodec *codec, | |||
| 313 | 313 | ||
| 314 | 314 | if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || | |
| 315 | 315 | !PyUnicode_Check((tobj = PyTuple_GET_ITEM(retobj, 0))) || | |
| 316 | - !(PyInt_Check(PyTuple_GET_ITEM(retobj, 1)) || | ||
| 317 | - PyLong_Check(PyTuple_GET_ITEM(retobj, 1)))) { | ||
| 316 | + !PyInt_Check(PyTuple_GET_ITEM(retobj, 1))) { | ||
| 318 | 317 | PyErr_SetString(PyExc_TypeError, | |
| 319 | 318 | "encoding error handler must return " | |
| 320 | 319 | "(unicode, int) tuple"); | |
@@ -433,8 +432,7 @@ multibytecodec_decerror(MultibyteCodec *codec, | |||
| 433 | 432 | ||
| 434 | 433 | if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || | |
| 435 | 434 | !PyUnicode_Check((retuni = PyTuple_GET_ITEM(retobj, 0))) || | |
| 436 | - !(PyInt_Check(PyTuple_GET_ITEM(retobj, 1)) || | ||
| 437 | - PyLong_Check(PyTuple_GET_ITEM(retobj, 1)))) { | ||
| 435 | + !PyInt_Check(PyTuple_GET_ITEM(retobj, 1))) { | ||
| 438 | 436 | PyErr_SetString(PyExc_TypeError, | |
| 439 | 437 | "decoding error handler must return " | |
| 440 | 438 | "(unicode, int) tuple"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,14 +112,14 @@ PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, | |||
| 112 | 112 | if (r->start == Py_None) { | |
| 113 | 113 | *start = *step < 0 ? length-1 : 0; | |
| 114 | 114 | } else { | |
| 115 | - if (!PyInt_Check(r->start) && !PyLong_Check(r->step)) return -1; | ||
| 115 | + if (!PyInt_Check(r->start)) return -1; | ||
| 116 | 116 | *start = PyInt_AsSsize_t(r->start); | |
| 117 | 117 | if (*start < 0) *start += length; | |
| 118 | 118 | } | |
| 119 | 119 | if (r->stop == Py_None) { | |
| 120 | 120 | *stop = *step < 0 ? -1 : length; | |
| 121 | 121 | } else { | |
| 122 | - if (!PyInt_Check(r->stop) && !PyLong_Check(r->step)) return -1; | ||
| 122 | + if (!PyInt_Check(r->stop)) return -1; | ||
| 123 | 123 | *stop = PyInt_AsSsize_t(r->stop); | |
| 124 | 124 | if (*stop < 0) *stop += length; | |
| 125 | 125 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -696,9 +696,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, | |||
| 696 | 696 | case 'k': { /* long sized bitfield */ | |
| 697 | 697 | unsigned long *p = va_arg(*p_va, unsigned long *); | |
| 698 | 698 | unsigned long ival; | |
| 699 | - if (PyInt_Check(arg)) | ||
| 700 | - ival = PyInt_AsUnsignedLongMask(arg); | ||
| 701 | - else if (PyLong_Check(arg)) | ||
| 699 | + if (PyLong_Check(arg)) | ||
| 702 | 700 | ival = PyLong_AsUnsignedLongMask(arg); | |
| 703 | 701 | else | |
| 704 | 702 | return converterr("integer<k>", arg, msgbuf, bufsize); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments