diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-22 08:02:49 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-22 08:02:49 (GMT) |
commit | 08d230a5408e9fac3adbb357f5fb4a43958991d4 (patch) | |
tree | 94e66616cc67b6d1164d87f9bf694a6850b982ff /Objects/genobject.c | |
parent | df9ba3623a1fcb745199b723ffd68e63f7a31153 (diff) | |
download | cpython-08d230a5408e9fac3adbb357f5fb4a43958991d4.zip cpython-08d230a5408e9fac3adbb357f5fb4a43958991d4.tar.gz cpython-08d230a5408e9fac3adbb357f5fb4a43958991d4.tar.bz2 |
Issue #24257: Fixed incorrect uses of PyObject_IsInstance().
Fixed segmentation fault in sqlite3.Row constructor with faked cursor type.
Fixed system error in the comparison of faked types.SimpleNamespace.
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r-- | Objects/genobject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index f125847..67e6ef9 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -398,8 +398,7 @@ _PyGen_FetchStopIterationValue(PyObject **pvalue) { PyErr_Fetch(&et, &ev, &tb); if (ev) { /* exception will usually be normalised already */ - if (Py_TYPE(ev) == (PyTypeObject *) et - || PyObject_IsInstance(ev, PyExc_StopIteration)) { + if (PyObject_TypeCheck(ev, (PyTypeObject *) et)) { value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); @@ -409,7 +408,7 @@ _PyGen_FetchStopIterationValue(PyObject **pvalue) { } else { /* normalisation required */ PyErr_NormalizeException(&et, &ev, &tb); - if (!PyObject_IsInstance(ev, PyExc_StopIteration)) { + if (!PyObject_TypeCheck(ev, (PyTypeObject *)PyExc_StopIteration)) { PyErr_Restore(et, ev, tb); return -1; } |