mirror of
https://github.com/python/cpython.git
synced 2025-11-09 01:51:26 +00:00
[3.13] gh-125331: Allow the parser to activate future imports on the fly (GH-125482) (#131062)
gh-125331: Allow the parser to activate future imports on the fly (GH-125482)
(cherry picked from commit 3bd3e09588)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
977af3a6a2
commit
ebd2ed7ad8
6 changed files with 50 additions and 2 deletions
|
|
@ -207,7 +207,7 @@ import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, EXTRA) }
|
|||
# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
|
||||
import_from[stmt_ty]:
|
||||
| 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets {
|
||||
_PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), EXTRA) }
|
||||
_PyPegen_checked_future_import(p, b->v.Name.id, c, _PyPegen_seq_count_dots(a), EXTRA) }
|
||||
| 'from' a=('.' | '...')+ 'import' b=import_from_targets {
|
||||
_PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }
|
||||
import_from_targets[asdl_alias_seq*]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue