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 <rep...@bugs.python.org>
<http://bugs.python.org/issue31091>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to