From 5f685ed783bda5aa3ccaaf4f64b7a9ae4c5b796b Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Fri, 22 Sep 2023 05:58:04 -0700 Subject: [PATCH] [3.12] GH-109190: Copyedit 3.12 What's New: Improved Error Messages (GH-109654) (#109687) (cherry picked from commit 16c24023c1f69f66d1e3313033be275a43329030) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/whatsnew/3.12.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index ed03c0c52b1936..eb4e26aece67e7 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -99,7 +99,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. Contributed 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): @@ -110,7 +110,7 @@ Improved Error Messages 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 will include ``self.`` instead of the closest match in the method - scope. Contributed by Pablo Galindo in :gh:`99139`. + scope. (Contributed by Pablo Galindo in :gh:`99139`.) >>> class A: ... def __init__(self): @@ -118,7 +118,7 @@ Improved Error Messages ... ... def foo(self): ... somethin = blech - + ... >>> A().foo() Traceback (most recent call last): File "", line 1 @@ -126,9 +126,8 @@ Improved Error Messages ^^^^^ NameError: name 'blech' is not defined. Did you mean: 'self.blech'? - * Improve the :exc:`SyntaxError` error message when the user types ``import x - from y`` instead of ``from y import x``. Contributed by Pablo Galindo in :gh:`98931`. + from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :gh:`98931`.) >>> import a.y.z from b.y.z Traceback (most recent call last): @@ -139,7 +138,7 @@ Improved Error Messages * :exc:`ImportError` exceptions raised from failed ``from import `` statements now include suggestions for the value of ```` based on the - available names in ````. Contributed by Pablo Galindo in :gh:`91058`. + available names in ````. (Contributed by Pablo Galindo in :gh:`91058`.) >>> from collections import chainmap Traceback (most recent call last):