diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2022-11-07 13:37:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 13:37:14 (GMT) |
commit | 6168e714be333b633dfa7e2d25549dea97a53431 (patch) | |
tree | b14991501a959c4f7d26a9ace1a5a1d09cbdd9a0 | |
parent | be31ecf8b3a3ceadf947a9a5c6dbc8150527cb0c (diff) | |
download | cpython-6168e714be333b633dfa7e2d25549dea97a53431.zip cpython-6168e714be333b633dfa7e2d25549dea97a53431.tar.gz cpython-6168e714be333b633dfa7e2d25549dea97a53431.tar.bz2 |
gh-98254: Add what's new entry for the improvement in commit bb56dead336357153a0c3b8cc9d9d6856d2c5a03 (#99197)
-rw-r--r-- | Doc/whatsnew/3.12.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 3802d0e..5e8d971 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -75,6 +75,15 @@ Important deprecations, removals or restrictions: Improved Error Messages ======================= +* Modules from the standard library are now potentially suggested as part of + the error messages displayed by the interpreter when a :exc:`NameError` is + raised to the top level. Contributed by Pablo Galindo in :gh:`98254`. + + >>> sys.version_info + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + NameError: name 'sys' is not defined. Did you forget to import 'sys'? + * Improve the error suggestion for :exc:`NameError` exceptions for instances. Now if a :exc:`NameError` is raised in a method and the instance has an attribute that's exactly equal to the name in the exception, the suggestion |