diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-16 16:12:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 16:12:03 (GMT) |
commit | 0ad81d4db2f409d72f469d0b74ab597be772a68e (patch) | |
tree | 3b8c64cda42f229d3cc3522b380840d6bdd10638 /Python | |
parent | 3b82cae774638ecf2baaee8fe2cac8fedafb2ca7 (diff) | |
download | cpython-0ad81d4db2f409d72f469d0b74ab597be772a68e.zip cpython-0ad81d4db2f409d72f469d0b74ab597be772a68e.tar.gz cpython-0ad81d4db2f409d72f469d0b74ab597be772a68e.tar.bz2 |
bpo-38530: Match exactly AttributeError and NameError when offering suggestions (GH-25443)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/suggestions.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/suggestions.c b/Python/suggestions.c index 258e3f1..e422760 100644 --- a/Python/suggestions.c +++ b/Python/suggestions.c @@ -181,9 +181,9 @@ offer_suggestions_for_name_error(PyNameErrorObject *exc) { PyObject *_Py_Offer_Suggestions(PyObject *exception) { PyObject *result = NULL; assert(!PyErr_Occurred()); - if (PyErr_GivenExceptionMatches(exception, PyExc_AttributeError)) { + if (Py_IS_TYPE(exception, (PyTypeObject*)PyExc_AttributeError)) { result = offer_suggestions_for_attribute_error((PyAttributeErrorObject *) exception); - } else if (PyErr_GivenExceptionMatches(exception, PyExc_NameError)) { + } else if (Py_IS_TYPE(exception, (PyTypeObject*)PyExc_NameError)) { result = offer_suggestions_for_name_error((PyNameErrorObject *) exception); } return result; |