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
3b66ebe7
Kaydet (Commit)
3b66ebe7
authored
Eki 23, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Eki 23, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31847: Fix commented out tests in test_syntax. (#4084)
SyntaxError now is raised instead of SyntaxWarning.
üst
828ca592
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
test_syntax.py
Lib/test/test_syntax.py
+10
-18
No files found.
Lib/test/test_syntax.py
Dosyayı görüntüle @
3b66ebe7
...
@@ -415,6 +415,15 @@ Misuse of the nonlocal and global statement can lead to a few unique syntax erro
...
@@ -415,6 +415,15 @@ Misuse of the nonlocal and global statement can lead to a few unique syntax erro
...
...
SyntaxError: name 'x' is used prior to nonlocal declaration
SyntaxError: name 'x' is used prior to nonlocal declaration
>>> def f():
... x = 1
... def g():
... x = 2
... nonlocal x
Traceback (most recent call last):
...
SyntaxError: name 'x' is assigned to before nonlocal declaration
>>> def f(x):
>>> def f(x):
... nonlocal x
... nonlocal x
Traceback (most recent call last):
Traceback (most recent call last):
...
@@ -440,24 +449,7 @@ From SF bug #1705365
...
@@ -440,24 +449,7 @@ From SF bug #1705365
...
...
SyntaxError: nonlocal declaration not allowed at module level
SyntaxError: nonlocal declaration not allowed at module level
TODO(jhylton): Figure out how to test SyntaxWarning with doctest.
From https://bugs.python.org/issue25973
## >>> def f(x):
## ... def f():
## ... print(x)
## ... nonlocal x
## Traceback (most recent call last):
## ...
## SyntaxWarning: name 'x' is assigned to before nonlocal declaration
## >>> def f():
## ... x = 1
## ... nonlocal x
## Traceback (most recent call last):
## ...
## SyntaxWarning: name 'x' is assigned to before nonlocal declaration
From https://bugs.python.org/issue25973
>>> class A:
>>> class A:
... def f(self):
... def f(self):
... nonlocal __x
... nonlocal __x
...
...
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