mirror of
https://github.com/python/cpython.git
synced 2025-08-09 03:19:15 +00:00
[3.12] gh-98931: Add custom error messages to invalid import/from with multiple targets (GH-105985) (#105991)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
025c9912ee
commit
c407ef0a8a
4 changed files with 1347 additions and 1206 deletions
|
@ -1621,6 +1621,22 @@ SyntaxError: Did you mean to use 'from ... import ...' instead?
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: Did you mean to use 'from ... import ...' instead?
|
||||
|
||||
>>> import a, b,c from b
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Did you mean to use 'from ... import ...' instead?
|
||||
|
||||
>>> import a.y.z, b.y.z, c.y.z from b.y.z
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Did you mean to use 'from ... import ...' instead?
|
||||
|
||||
>>> import a,b,c from b as bar
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Did you mean to use 'from ... import ...' instead?
|
||||
|
||||
>>> import a.y.z, b.y.z, c.y.z from b.y.z as bar
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Did you mean to use 'from ... import ...' instead?
|
||||
|
||||
# Check that we dont raise the "trailing comma" error if there is more
|
||||
# input to the left of the valid part that we parsed.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue