[issue31091] remove dead code in PyErr_GivenExceptionMatches()
Stefan Behnel
report at bugs.python.org
Mon Jul 31 15:24:27 EDT 2017
New submission from Stefan Behnel:
PyObject *exception, *value, *tb;
PyErr_Fetch(&exception, &value, &tb);
/* PyObject_IsSubclass() can recurse and therefore is
not safe (see test_bad_getattr in test.pickletester). */
res = PyType_IsSubtype((PyTypeObject *)err, (PyTypeObject *)exc);
/* This function must not fail, so print the error here */
if (res == -1) {
PyErr_WriteUnraisable(err);
res = 0;
}
PyErr_Restore(exception, value, tb);
According to the comment, there was previously a call to PyObject_IsSubclass() involved which could fail, but since it was replaced with a call to PyType_IsSubtype(), it can no longer fail.
See pull request.
----------
components: Interpreter Core
messages: 299579
nosy: scoder
priority: normal
pull_requests: 3010
severity: normal
status: open
title: remove dead code in PyErr_GivenExceptionMatches()
type: performance
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31091>
_______________________________________
More information about the Python-bugs-list
mailing list