Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
00d44429
Kaydet (Commit)
00d44429
authored
Eyl 26, 2015
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.5 (#25131)
üst
9cd90cca
58b53953
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
test_ast.py
Lib/test/test_ast.py
+9
-9
NEWS
Misc/NEWS
+3
-0
ast.c
Python/ast.c
+10
-4
No files found.
Lib/test/test_ast.py
Dosyayı görüntüle @
00d44429
...
...
@@ -983,15 +983,15 @@ exec_results = [
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'GeneratorExp'
,
(
1
,
1
),
(
'Tuple'
,
(
1
,
2
),
[(
'Name'
,
(
1
,
2
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
1
,
4
),
'b'
,
(
'Load'
,))],
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
1
,
11
),
[(
'Name'
,
(
1
,
11
),
'a'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
13
),
'b'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
1
,
18
),
'c'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'GeneratorExp'
,
(
1
,
1
),
(
'Tuple'
,
(
1
,
2
),
[(
'Name'
,
(
1
,
2
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
1
,
4
),
'b'
,
(
'Load'
,))],
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
1
,
12
),
[(
'Name'
,
(
1
,
12
),
'a'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
14
),
'b'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
1
,
20
),
'c'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'GeneratorExp'
,
(
2
,
4
),
(
'Tuple'
,
(
3
,
4
),
[(
'Name'
,
(
3
,
4
),
'Aa'
,
(
'Load'
,)),
(
'Name'
,
(
5
,
7
),
'Bb'
,
(
'Load'
,))],
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
8
,
4
),
[(
'Name'
,
(
8
,
4
),
'Aa'
,
(
'Store'
,)),
(
'Name'
,
(
10
,
4
),
'Bb'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
10
,
10
),
'Cc'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'DictComp'
,
(
1
,
1
),
(
'Name'
,
(
1
,
1
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
1
,
5
),
'b'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Name'
,
(
1
,
11
),
'w'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
16
),
'x'
,
(
'Load'
,)),
[]),
(
'comprehension'
,
(
'Name'
,
(
1
,
22
),
'm'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
27
),
'p'
,
(
'Load'
,)),
[(
'Name'
,
(
1
,
32
),
'g'
,
(
'Load'
,))])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'DictComp'
,
(
1
,
1
),
(
'Name'
,
(
1
,
1
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
1
,
5
),
'b'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
1
,
11
),
[(
'Name'
,
(
1
,
11
),
'v'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
13
),
'w'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
1
,
18
),
'x'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'SetComp'
,
(
1
,
1
),
(
'Name'
,
(
1
,
1
),
'r'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Name'
,
(
1
,
7
),
'l'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
12
),
'x'
,
(
'Load'
,)),
[(
'Name'
,
(
1
,
17
),
'g'
,
(
'Load'
,))])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'SetComp'
,
(
1
,
1
),
(
'Name'
,
(
1
,
1
),
'r'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
1
,
7
),
[(
'Name'
,
(
1
,
7
),
'l'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
9
),
'm'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
1
,
14
),
'x'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'DictComp'
,
(
1
,
0
),
(
'Name'
,
(
1
,
1
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
1
,
5
),
'b'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Name'
,
(
1
,
11
),
'w'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
16
),
'x'
,
(
'Load'
,)),
[]),
(
'comprehension'
,
(
'Name'
,
(
1
,
22
),
'm'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
27
),
'p'
,
(
'Load'
,)),
[(
'Name'
,
(
1
,
32
),
'g'
,
(
'Load'
,))])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'DictComp'
,
(
1
,
0
),
(
'Name'
,
(
1
,
1
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
1
,
5
),
'b'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
1
,
11
),
[(
'Name'
,
(
1
,
11
),
'v'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
13
),
'w'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
1
,
18
),
'x'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'SetComp'
,
(
1
,
0
),
(
'Name'
,
(
1
,
1
),
'r'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Name'
,
(
1
,
7
),
'l'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
12
),
'x'
,
(
'Load'
,)),
[(
'Name'
,
(
1
,
17
),
'g'
,
(
'Load'
,))])]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'SetComp'
,
(
1
,
0
),
(
'Name'
,
(
1
,
1
),
'r'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Tuple'
,
(
1
,
7
),
[(
'Name'
,
(
1
,
7
),
'l'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
9
),
'm'
,
(
'Store'
,))],
(
'Store'
,)),
(
'Name'
,
(
1
,
14
),
'x'
,
(
'Load'
,)),
[])]))]),
(
'Module'
,
[(
'AsyncFunctionDef'
,
(
1
,
6
),
'f'
,
(
'arguments'
,
[],
None
,
[],
[],
None
,
[]),
[(
'Expr'
,
(
2
,
1
),
(
'Await'
,
(
2
,
1
),
(
'Call'
,
(
2
,
7
),
(
'Name'
,
(
2
,
7
),
'something'
,
(
'Load'
,)),
[],
[])))],
[],
None
)]),
(
'Module'
,
[(
'AsyncFunctionDef'
,
(
1
,
6
),
'f'
,
(
'arguments'
,
[],
None
,
[],
[],
None
,
[]),
[(
'AsyncFor'
,
(
2
,
7
),
(
'Name'
,
(
2
,
11
),
'e'
,
(
'Store'
,)),
(
'Name'
,
(
2
,
16
),
'i'
,
(
'Load'
,)),
[(
'Expr'
,
(
2
,
19
),
(
'Num'
,
(
2
,
19
),
1
))],
[(
'Expr'
,
(
3
,
7
),
(
'Num'
,
(
3
,
7
),
2
))])],
[],
None
)]),
(
'Module'
,
[(
'AsyncFunctionDef'
,
(
1
,
6
),
'f'
,
(
'arguments'
,
[],
None
,
[],
[],
None
,
[]),
[(
'AsyncWith'
,
(
2
,
7
),
[(
'withitem'
,
(
'Name'
,
(
2
,
12
),
'a'
,
(
'Load'
,)),
(
'Name'
,
(
2
,
17
),
'b'
,
(
'Store'
,)))],
[(
'Expr'
,
(
2
,
20
),
(
'Num'
,
(
2
,
20
),
1
))])],
[],
None
)]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'Dict'
,
(
1
,
1
),
[
None
,
(
'Num'
,
(
1
,
10
),
2
)],
[(
'Dict'
,
(
1
,
4
),
[(
'Num'
,
(
1
,
4
),
1
)],
[(
'Num'
,
(
1
,
6
),
2
)]),
(
'Num'
,
(
1
,
12
),
3
)]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'Set'
,
(
1
,
1
),
[(
'Starred'
,
(
1
,
1
),
(
'Set'
,
(
1
,
3
),
[(
'Num'
,
(
1
,
3
),
1
),
(
'Num'
,
(
1
,
6
),
2
)]),
(
'Load'
,)),
(
'Num'
,
(
1
,
10
),
3
)]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'Dict'
,
(
1
,
0
),
[
None
,
(
'Num'
,
(
1
,
10
),
2
)],
[(
'Dict'
,
(
1
,
3
),
[(
'Num'
,
(
1
,
4
),
1
)],
[(
'Num'
,
(
1
,
6
),
2
)]),
(
'Num'
,
(
1
,
12
),
3
)]))]),
(
'Module'
,
[(
'Expr'
,
(
1
,
0
),
(
'Set'
,
(
1
,
0
),
[(
'Starred'
,
(
1
,
1
),
(
'Set'
,
(
1
,
2
),
[(
'Num'
,
(
1
,
3
),
1
),
(
'Num'
,
(
1
,
6
),
2
)]),
(
'Load'
,)),
(
'Num'
,
(
1
,
10
),
3
)]))]),
]
single_results
=
[
(
'Interactive'
,
[(
'Expr'
,
(
1
,
0
),
(
'BinOp'
,
(
1
,
0
),
(
'Num'
,
(
1
,
0
),
1
),
(
'Add'
,),
(
'Num'
,
(
1
,
2
),
2
)))]),
...
...
@@ -1002,10 +1002,10 @@ eval_results = [
(
'Expression'
,
(
'BinOp'
,
(
1
,
0
),
(
'Name'
,
(
1
,
0
),
'a'
,
(
'Load'
,)),
(
'Add'
,),
(
'Name'
,
(
1
,
4
),
'b'
,
(
'Load'
,)))),
(
'Expression'
,
(
'UnaryOp'
,
(
1
,
0
),
(
'Not'
,),
(
'Name'
,
(
1
,
4
),
'v'
,
(
'Load'
,)))),
(
'Expression'
,
(
'Lambda'
,
(
1
,
0
),
(
'arguments'
,
[],
None
,
[],
[],
None
,
[]),
(
'NameConstant'
,
(
1
,
7
),
None
))),
(
'Expression'
,
(
'Dict'
,
(
1
,
2
),
[(
'Num'
,
(
1
,
2
),
1
)],
[(
'Num'
,
(
1
,
4
),
2
)])),
(
'Expression'
,
(
'Dict'
,
(
1
,
0
),
[(
'Num'
,
(
1
,
2
),
1
)],
[(
'Num'
,
(
1
,
4
),
2
)])),
(
'Expression'
,
(
'Dict'
,
(
1
,
0
),
[],
[])),
(
'Expression'
,
(
'Set'
,
(
1
,
1
),
[(
'NameConstant'
,
(
1
,
1
),
None
)])),
(
'Expression'
,
(
'Dict'
,
(
2
,
6
),
[(
'Num'
,
(
2
,
6
),
1
)],
[(
'Num'
,
(
4
,
10
),
2
)])),
(
'Expression'
,
(
'Set'
,
(
1
,
0
),
[(
'NameConstant'
,
(
1
,
1
),
None
)])),
(
'Expression'
,
(
'Dict'
,
(
1
,
0
),
[(
'Num'
,
(
2
,
6
),
1
)],
[(
'Num'
,
(
4
,
10
),
2
)])),
(
'Expression'
,
(
'ListComp'
,
(
1
,
1
),
(
'Name'
,
(
1
,
1
),
'a'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Name'
,
(
1
,
7
),
'b'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
12
),
'c'
,
(
'Load'
,)),
[(
'Name'
,
(
1
,
17
),
'd'
,
(
'Load'
,))])])),
(
'Expression'
,
(
'GeneratorExp'
,
(
1
,
1
),
(
'Name'
,
(
1
,
1
),
'a'
,
(
'Load'
,)),
[(
'comprehension'
,
(
'Name'
,
(
1
,
7
),
'b'
,
(
'Store'
,)),
(
'Name'
,
(
1
,
12
),
'c'
,
(
'Load'
,)),
[(
'Name'
,
(
1
,
17
),
'd'
,
(
'Load'
,))])])),
(
'Expression'
,
(
'Compare'
,
(
1
,
0
),
(
'Num'
,
(
1
,
0
),
1
),
[(
'Lt'
,),
(
'Lt'
,)],
[(
'Num'
,
(
1
,
4
),
2
),
(
'Num'
,
(
1
,
8
),
3
)])),
...
...
Misc/NEWS
Dosyayı görüntüle @
00d44429
...
...
@@ -131,6 +131,9 @@ Release date: TBA
Core and Builtins
-----------------
- Issue #25131: Make the line number and column offset of set/dict literals and
comprehensions correspond to the opening brace.
- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public
Python.h header to fix a compilation error with OpenMP. PyThreadState_GET()
becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies.
...
...
Python/ast.c
Dosyayı görüntüle @
00d44429
...
...
@@ -2107,6 +2107,7 @@ ast_for_atom(struct compiling *c, const node *n)
* (comp_for | (',' (test ':' test | '**' test))* [','])) |
* ((test | '*' test)
* (comp_for | (',' (test | '*' test))* [','])) ) */
expr_ty
res
;
ch
=
CHILD
(
n
,
1
);
if
(
TYPE
(
ch
)
==
RBRACE
)
{
/* It's an empty dict. */
...
...
@@ -2118,12 +2119,12 @@ ast_for_atom(struct compiling *c, const node *n)
(
NCH
(
ch
)
>
1
&&
TYPE
(
CHILD
(
ch
,
1
))
==
COMMA
))
{
/* It's a set display. */
re
turn
ast_for_setdisplay
(
c
,
ch
);
re
s
=
ast_for_setdisplay
(
c
,
ch
);
}
else
if
(
NCH
(
ch
)
>
1
&&
TYPE
(
CHILD
(
ch
,
1
))
==
comp_for
)
{
/* It's a set comprehension. */
re
turn
ast_for_setcomp
(
c
,
ch
);
re
s
=
ast_for_setcomp
(
c
,
ch
);
}
else
if
(
NCH
(
ch
)
>
3
-
is_dict
&&
TYPE
(
CHILD
(
ch
,
3
-
is_dict
))
==
comp_for
)
{
...
...
@@ -2133,12 +2134,17 @@ ast_for_atom(struct compiling *c, const node *n)
"dict comprehension"
);
return
NULL
;
}
re
turn
ast_for_dictcomp
(
c
,
ch
);
re
s
=
ast_for_dictcomp
(
c
,
ch
);
}
else
{
/* It's a dictionary display. */
re
turn
ast_for_dictdisplay
(
c
,
ch
);
re
s
=
ast_for_dictdisplay
(
c
,
ch
);
}
if
(
res
)
{
res
->
lineno
=
LINENO
(
n
);
res
->
col_offset
=
n
->
n_col_offset
;
}
return
res
;
}
}
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment