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
5941d191
Kaydet (Commit)
5941d191
authored
Şub 27, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add from __future__ import nested_scopes to strings passed to compile
üst
bd00cdaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
test_scope.py
Lib/test/test_scope.py
+12
-6
No files found.
Lib/test/test_scope.py
Dosyayı görüntüle @
5941d191
...
...
@@ -179,21 +179,24 @@ verify(f(6) == 720)
print
"11. unoptimized namespaces"
check_syntax
(
"""def unoptimized_clash1(strip):
check_syntax
(
"""from __future__ import nested_scopes
def unoptimized_clash1(strip):
def f(s):
from string import *
return strip(s) # ambiguity: free or local
return f
"""
)
check_syntax
(
"""def unoptimized_clash2():
check_syntax
(
"""from __future__ import nested_scopes
def unoptimized_clash2():
from string import *
def f(s):
return strip(s) # ambiguity: global or local
return f
"""
)
check_syntax
(
"""def unoptimized_clash2():
check_syntax
(
"""from __future__ import nested_scopes
def unoptimized_clash2():
from string import *
def g():
def f(s):
...
...
@@ -202,20 +205,23 @@ check_syntax("""def unoptimized_clash2():
"""
)
# XXX could allow this for exec with const argument, but what's the point
check_syntax
(
"""def error(y):
check_syntax
(
"""from __future__ import nested_scopes
def error(y):
exec "a = 1"
def f(x):
return x + y
return f
"""
)
check_syntax
(
"""def f(x):
check_syntax
(
"""from __future__ import nested_scopes
def f(x):
def g():
return x
del x # can't del name
"""
)
check_syntax
(
"""def f():
check_syntax
(
"""from __future__ import nested_scopes
def f():
def g():
from string import *
return strip # global or local?
...
...
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