Browse Source
bpo-38530: Offer suggestions on NameError (GH-25397)
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?
pull/25407/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 287 additions and 10 deletions
-
7Doc/library/exceptions.rst
-
17Doc/whatsnew/3.10.rst
-
5Include/cpython/pyerrors.h
-
123Lib/test/test_exceptions.py
-
3Misc/NEWS.d/next/Core and Builtins/2021-04-14-03-53-06.bpo-38530.rNI_G1.rst
-
65Objects/exceptions.c
-
14Python/ceval.c
-
63Python/suggestions.c
@ -0,0 +1,3 @@ |
|||
When printing :exc:`NameError` raised by the interpreter, |
|||
:c:func:`PyErr_Display` will offer suggestions of similar variable names in |
|||
the function that the exception was raised from. Patch by Pablo Galindo |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue