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
a93a663d
Kaydet (Commit)
a93a663d
authored
Nis 27, 2018
tarafından
Zsolt Dollenstein
Kaydeden (comit)
Yury Selivanov
Nis 27, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[3.7] bpo-33363: raise SyntaxError for async for/with outside async functions (GH-6616). (GH-6619)
üst
dd3ede75
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
test_coroutines.py
Lib/test/test_coroutines.py
+16
-1
2018-04-26-22-48-28.bpo-33363.8RCnN2.rst
...ore and Builtins/2018-04-26-22-48-28.bpo-33363.8RCnN2.rst
+2
-0
compile.c
Python/compile.c
+7
-0
No files found.
Lib/test/test_coroutines.py
Dosyayı görüntüle @
a93a663d
...
@@ -362,7 +362,22 @@ class AsyncBadSyntaxTest(unittest.TestCase):
...
@@ -362,7 +362,22 @@ class AsyncBadSyntaxTest(unittest.TestCase):
"""def foo():
"""def foo():
async def bar():
async def bar():
pass
\n
await a
pass
\n
await a
"""
]
"""
,
"""def foo():
async for i in arange(2):
pass
"""
,
"""def foo():
async with resource:
pass
"""
,
"""async with resource:
pass
"""
,
"""async for i in arange(2):
pass
"""
,
]
for
code
in
samples
:
for
code
in
samples
:
with
self
.
subTest
(
code
=
code
),
self
.
assertRaises
(
SyntaxError
):
with
self
.
subTest
(
code
=
code
),
self
.
assertRaises
(
SyntaxError
):
...
...
Misc/NEWS.d/next/Core and Builtins/2018-04-26-22-48-28.bpo-33363.8RCnN2.rst
0 → 100644
Dosyayı görüntüle @
a93a663d
Raise a SyntaxError for ``async with`` and ``async for`` statements outside
of async functions.
Python/compile.c
Dosyayı görüntüle @
a93a663d
...
@@ -2339,6 +2339,10 @@ compiler_async_for(struct compiler *c, stmt_ty s)
...
@@ -2339,6 +2339,10 @@ compiler_async_for(struct compiler *c, stmt_ty s)
basicblock
*
try
,
*
except
,
*
end
,
*
after_try
,
*
try_cleanup
,
basicblock
*
try
,
*
except
,
*
end
,
*
after_try
,
*
try_cleanup
,
*
after_loop_else
;
*
after_loop_else
;
if
(
c
->
u
->
u_scope_type
!=
COMPILER_SCOPE_ASYNC_FUNCTION
)
{
return
compiler_error
(
c
,
"'async for' outside async function"
);
}
PyObject
*
stop_aiter_error
=
_PyUnicode_FromId
(
&
PyId_StopAsyncIteration
);
PyObject
*
stop_aiter_error
=
_PyUnicode_FromId
(
&
PyId_StopAsyncIteration
);
if
(
stop_aiter_error
==
NULL
)
{
if
(
stop_aiter_error
==
NULL
)
{
return
0
;
return
0
;
...
@@ -4204,6 +4208,9 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos)
...
@@ -4204,6 +4208,9 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos)
withitem_ty
item
=
asdl_seq_GET
(
s
->
v
.
AsyncWith
.
items
,
pos
);
withitem_ty
item
=
asdl_seq_GET
(
s
->
v
.
AsyncWith
.
items
,
pos
);
assert
(
s
->
kind
==
AsyncWith_kind
);
assert
(
s
->
kind
==
AsyncWith_kind
);
if
(
c
->
u
->
u_scope_type
!=
COMPILER_SCOPE_ASYNC_FUNCTION
)
{
return
compiler_error
(
c
,
"'async with' outside async function"
);
}
block
=
compiler_new_block
(
c
);
block
=
compiler_new_block
(
c
);
finally
=
compiler_new_block
(
c
);
finally
=
compiler_new_block
(
c
);
...
...
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