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
1e93b060
Kaydet (Commit)
1e93b060
authored
May 15, 2013
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
complain about "global __class__" in a class body (closes #17983)
üst
c032f16d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
test_scope.py
Lib/test/test_scope.py
+4
-0
NEWS
Misc/NEWS
+3
-0
symtable.c
Python/symtable.c
+6
-0
No files found.
Lib/test/test_scope.py
Dosyayı görüntüle @
1e93b060
...
@@ -743,6 +743,10 @@ class ScopeTests(unittest.TestCase):
...
@@ -743,6 +743,10 @@ class ScopeTests(unittest.TestCase):
del
tester
del
tester
self
.
assertIsNone
(
ref
())
self
.
assertIsNone
(
ref
())
def
test__Class__Global
(
self
):
s
=
"class X:
\n
global __class__
\n
def f(self): super()"
self
.
assertRaises
(
SyntaxError
,
exec
,
s
)
def
test_main
():
def
test_main
():
run_unittest
(
ScopeTests
)
run_unittest
(
ScopeTests
)
...
...
Misc/NEWS
Dosyayı görüntüle @
1e93b060
...
@@ -12,6 +12,9 @@ What's New in Python 3.3.3 release candidate 1?
...
@@ -12,6 +12,9 @@ What's New in Python 3.3.3 release candidate 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #17983: Raise a SyntaxError for a ``global __class__`` statement in a
class body.
- Issue #17927: Frame objects kept arguments alive if they had been copied into
- Issue #17927: Frame objects kept arguments alive if they had been copied into
a cell, even if the cell was cleared.
a cell, even if the cell was cleared.
...
...
Python/symtable.c
Dosyayı görüntüle @
1e93b060
...
@@ -1236,6 +1236,12 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
...
@@ -1236,6 +1236,12 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
asdl_seq
*
seq
=
s
->
v
.
Global
.
names
;
asdl_seq
*
seq
=
s
->
v
.
Global
.
names
;
for
(
i
=
0
;
i
<
asdl_seq_LEN
(
seq
);
i
++
)
{
for
(
i
=
0
;
i
<
asdl_seq_LEN
(
seq
);
i
++
)
{
identifier
name
=
(
identifier
)
asdl_seq_GET
(
seq
,
i
);
identifier
name
=
(
identifier
)
asdl_seq_GET
(
seq
,
i
);
if
(
st
->
st_cur
->
ste_type
==
ClassBlock
&&
!
PyUnicode_CompareWithASCIIString
(
name
,
"__class__"
))
{
PyErr_SetString
(
PyExc_SyntaxError
,
"cannot make __class__ global"
);
PyErr_SyntaxLocationEx
(
st
->
st_filename
,
s
->
lineno
,
s
->
col_offset
);
return
0
;
}
long
cur
=
symtable_lookup
(
st
,
name
);
long
cur
=
symtable_lookup
(
st
,
name
);
if
(
cur
<
0
)
if
(
cur
<
0
)
VISIT_QUIT
(
st
,
0
);
VISIT_QUIT
(
st
,
0
);
...
...
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