diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2022-11-01 13:01:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 13:01:20 (GMT) |
commit | 395d4285bfba2177719efd826fbb89bf3efcf641 (patch) | |
tree | 58cdc74ef24a74170efc3c021e29576ed6d13579 /Doc | |
parent | 0e15c31c7e9907fdbe38a3f419b669fed5bb3b33 (diff) | |
download | cpython-395d4285bfba2177719efd826fbb89bf3efcf641.zip cpython-395d4285bfba2177719efd826fbb89bf3efcf641.tar.gz cpython-395d4285bfba2177719efd826fbb89bf3efcf641.tar.bz2 |
gh-98931: Improve error message when the user types 'import x from y' instead of 'from y import x' (#98932)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.12.rst | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 18751f5..a943256 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -70,6 +70,18 @@ Important deprecations, removals or restrictions: * :pep:`623`, Remove wstr from Unicode +Improved Error Messages +======================= + +* 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`. + + >>> import a.y.z from b.y.z + Traceback (most recent call last): + File "<stdin>", line 1 + import a.y.z from b.y.z + ^^^^^^^^^^^^^^^^^^^^^^^ + SyntaxError: Did you mean to use 'from ... import ...' instead? New Features ============ |