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
e977ad4d
Kaydet (Commit)
e977ad4d
authored
Agu 20, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
deprecate some useless, noop methods in symtable
üst
f647dc10
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
16 deletions
+30
-16
symtable.rst
Doc/library/symtable.rst
+0
-9
symtable.py
Lib/symtable.py
+11
-7
test_symtable.py
Lib/test/test_symtable.py
+16
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/symtable.rst
Dosyayı görüntüle @
e977ad4d
...
...
@@ -144,15 +144,6 @@ Examining Symbol Tables
Return ``True`` if the symbol is global.
.. method:: is_vararg()
Return ``True`` if the symbol is a star arg (receives varargs).
.. method:: is_kewordarg()
Return ``True`` if the symbol is a two-star arg (receives keyword
arguments).
.. method:: is_local()
Return ``True`` if the symbol is local to its block.
...
...
Lib/symtable.py
Dosyayı görüntüle @
e977ad4d
...
...
@@ -2,11 +2,10 @@
import
_symtable
from
_symtable
import
(
USE
,
DEF_GLOBAL
,
DEF_LOCAL
,
DEF_PARAM
,
DEF_STAR
,
DEF_DOUBLESTAR
,
DEF_INTUPLE
,
DEF_FREE
,
DEF_FREE_GLOBAL
,
DEF_FREE_CLASS
,
DEF_IMPORT
,
DEF_BOUND
,
OPT_IMPORT_STAR
,
OPT_EXEC
,
OPT_BARE_EXEC
,
SCOPE_OFF
,
SCOPE_MASK
,
FREE
,
GLOBAL_IMPLICIT
,
GLOBAL_EXPLICIT
)
DEF_IMPORT
,
DEF_BOUND
,
OPT_IMPORT_STAR
,
OPT_EXEC
,
OPT_BARE_EXEC
,
SCOPE_OFF
,
SCOPE_MASK
,
FREE
,
GLOBAL_IMPLICIT
,
GLOBAL_EXPLICIT
)
import
warnings
import
weakref
__all__
=
[
"symtable"
,
"SymbolTable"
,
"newSymbolTable"
,
"Class"
,
...
...
@@ -194,10 +193,14 @@ class Symbol(object):
return
bool
(
self
.
__scope
in
(
GLOBAL_IMPLICIT
,
GLOBAL_EXPLICIT
))
def
is_vararg
(
self
):
return
bool
(
self
.
__flags
&
DEF_STAR
)
warnings
.
warn
(
"is_vararg() is obsolete and will be removed"
,
DeprecationWarning
,
2
)
return
False
def
is_keywordarg
(
self
):
return
bool
(
self
.
__flags
&
DEF_DOUBLESTAR
)
warnings
.
warn
(
"is_keywordarg() is obsolete and will be removed"
,
DeprecationWarning
,
2
)
return
False
def
is_local
(
self
):
return
bool
(
self
.
__flags
&
DEF_BOUND
)
...
...
@@ -212,7 +215,8 @@ class Symbol(object):
return
bool
(
self
.
__flags
&
DEF_LOCAL
)
def
is_in_tuple
(
self
):
return
bool
(
self
.
__flags
&
DEF_INTUPLE
)
warnings
.
warn
(
"is_in_tuple() is obsolete and will be removed"
,
DeprecationWarning
,
2
)
def
is_namespace
(
self
):
"""Returns true if name binding introduces new namespace.
...
...
Lib/test/test_symtable.py
Dosyayı görüntüle @
e977ad4d
...
...
@@ -55,6 +55,22 @@ class SymtableTest(unittest.TestCase):
internal
=
find_block
(
spam
,
"internal"
)
foo
=
find_block
(
top
,
"foo"
)
def
test_noops
(
self
):
# Check methods that don't work. They should warn and return False.
def
check
(
w
,
msg
):
self
.
assertEqual
(
str
(
w
.
message
),
msg
)
sym
=
self
.
top
.
lookup
(
"glob"
)
with
test_support
.
catch_warning
()
as
w
:
warnings
.
simplefilter
(
"always"
,
DeprecationWarning
)
self
.
assertFalse
(
sym
.
is_vararg
())
check
(
w
,
"is_vararg() is obsolete and will be removed"
)
w
.
reset
()
self
.
assertFalse
(
sym
.
is_keywordarg
())
check
(
w
,
"is_keywordarg() is obsolete and will be removed"
)
w
.
reset
()
self
.
assertFalse
(
sym
.
is_in_tuple
())
check
(
w
,
"is_in_tuple() is obsolete and will be removed"
)
def
test_type
(
self
):
self
.
assertEqual
(
self
.
top
.
get_type
(),
"module"
)
self
.
assertEqual
(
self
.
Mine
.
get_type
(),
"class"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
e977ad4d
...
...
@@ -54,6 +54,9 @@ Core and Builtins
Library
-------
- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
symtable.Symbol have been deprecated for removal in 3.0 and the next release.
- Issue #2234: distutils failed for some versions of the cygwin compiler. The
version reported by these tools does not necessarily follow the python
version numbering scheme, so the module is less strict when parsing it.
...
...
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