diff options
Diffstat (limited to 'Objects/exceptions.c')
| -rw-r--r-- | Objects/exceptions.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 0cd819c..9e298f0 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -1089,7 +1089,7 @@ SyntaxError_str(PySyntaxErrorObject *self) have_filename = (self->filename != NULL) && PyString_Check(self->filename); - have_lineno = (self->lineno != NULL) && PyInt_Check(self->lineno); + have_lineno = (self->lineno != NULL) && PyInt_CheckExact(self->lineno); if (!have_filename && !have_lineno) return str; @@ -1225,10 +1225,8 @@ get_int(PyObject *attr, Py_ssize_t *value, const char *name) return -1; } - if (PyInt_Check(attr)) { - *value = PyInt_AS_LONG(attr); - } else if (PyLong_Check(attr)) { - *value = _PyLong_AsSsize_t(attr); + if (PyLong_Check(attr)) { + *value = PyLong_AsSsize_t(attr); if (*value == -1 && PyErr_Occurred()) return -1; } else { @@ -1515,8 +1513,8 @@ UnicodeError_init(PyUnicodeErrorObject *self, PyObject *args, PyObject *kwds, if (!PyArg_ParseTuple(args, "O!O!O!O!O!", &PyString_Type, &self->encoding, objecttype, &self->object, - &PyInt_Type, &self->start, - &PyInt_Type, &self->end, + &PyLong_Type, &self->start, + &PyLong_Type, &self->end, &PyString_Type, &self->reason)) { self->encoding = self->object = self->start = self->end = self->reason = NULL; @@ -1748,8 +1746,8 @@ UnicodeTranslateError_init(PyUnicodeErrorObject *self, PyObject *args, if (!PyArg_ParseTuple(args, "O!O!O!O!", &PyUnicode_Type, &self->object, - &PyInt_Type, &self->start, - &PyInt_Type, &self->end, + &PyLong_Type, &self->start, + &PyLong_Type, &self->end, &PyString_Type, &self->reason)) { self->object = self->start = self->end = self->reason = NULL; return -1; |
