From 0c277bc6998112a17643f128326f96706cac79e5 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 7 Nov 2022 12:11:41 +0000 Subject: [PATCH 1/3] gh-98254: Add what's new entry for the improvement in commit bb56dead336357153a0c3b8cc9d9d6856d2c5a03 --- Doc/whatsnew/3.12.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 53c72e957d64eb..e63c0bde2f5b3a 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 an :exc:`NameError` is + raised to the top level. Contrubuted by Pablo Galindo in :gh:`98254`. + + >>> sys.version_info + Traceback (most recent call last): + File "", line 1, in + 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 From ddcd6215687e101248e1d6d6facd3545632fcdb5 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 7 Nov 2022 12:37:21 +0000 Subject: [PATCH 2/3] Update Doc/whatsnew/3.12.rst Co-authored-by: Hugo van Kemenade --- Doc/whatsnew/3.12.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index e63c0bde2f5b3a..9c8815b2a4e856 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -76,7 +76,7 @@ Improved Error Messages ======================= * Modules from the standard library are now potentially suggested as part of - the error messages displayed by the interpreter when an :exc:`NameError` is + the error messages displayed by the interpreter when a :exc:`NameError` is raised to the top level. Contrubuted by Pablo Galindo in :gh:`98254`. >>> sys.version_info From cd78f7a16e3efb87540e9ca01e180051e9ea0d9d Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 7 Nov 2022 12:37:28 +0000 Subject: [PATCH 3/3] Update Doc/whatsnew/3.12.rst Co-authored-by: Hugo van Kemenade --- Doc/whatsnew/3.12.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 9c8815b2a4e856..33dd88ff0430e1 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -77,7 +77,7 @@ 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. Contrubuted by Pablo Galindo in :gh:`98254`. + raised to the top level. Contributed by Pablo Galindo in :gh:`98254`. >>> sys.version_info Traceback (most recent call last):