[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.
Dennis Sweeney
report at bugs.python.org
Wed Nov 17 00:58:06 EST 2021
Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:
Even shorter reproducer:
-----------------------------
try:
aab
except BaseException as E:
E.with_traceback(None)
raise ZeroDivisionError()
-----------------------------
Bisection points to the initial implementation of suggestions.c:
5bf8bf2267cd109970b2d946d43b2e9f71379ba2 is the first bad commit
commit 5bf8bf2267cd109970b2d946d43b2e9f71379ba2
Author: Pablo Galindo <Pablogsal at gmail.com>
Date: Wed Apr 14 15:10:33 2021 +0100
bpo-38530: Offer suggestions on NameError (GH-25397)
When printing NameError raised by the interpreter, PyErr_Display
will offer suggestions of simmilar variable names in the function that the exception
was raised from:
>>> schwarzschild_black_hole = None
>>> schwarschild_black_hole
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45826>
_______________________________________
More information about the Python-bugs-list
mailing list