mirror of https://github.com/python/cpython
remove deprecated symtable.Symbol methods
This commit is contained in:
parent
7bee77c876
commit
b3dd5485da
|
@ -5,7 +5,6 @@ from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM,
|
||||||
DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC,
|
DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC,
|
||||||
SCOPE_OFF, SCOPE_MASK, FREE, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
|
SCOPE_OFF, SCOPE_MASK, FREE, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
|
||||||
|
|
||||||
import warnings
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
__all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"]
|
__all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"]
|
||||||
|
@ -191,16 +190,6 @@ class Symbol(object):
|
||||||
def is_global(self):
|
def is_global(self):
|
||||||
return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT))
|
return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT))
|
||||||
|
|
||||||
def is_vararg(self):
|
|
||||||
warnings.warn("is_vararg() is obsolete and will be removed",
|
|
||||||
DeprecationWarning, 2)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def is_keywordarg(self):
|
|
||||||
warnings.warn("is_keywordarg() is obsolete and will be removed",
|
|
||||||
DeprecationWarning, 2)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def is_local(self):
|
def is_local(self):
|
||||||
return bool(self.__flags & DEF_BOUND)
|
return bool(self.__flags & DEF_BOUND)
|
||||||
|
|
||||||
|
@ -213,10 +202,6 @@ class Symbol(object):
|
||||||
def is_assigned(self):
|
def is_assigned(self):
|
||||||
return bool(self.__flags & DEF_LOCAL)
|
return bool(self.__flags & DEF_LOCAL)
|
||||||
|
|
||||||
def is_in_tuple(self):
|
|
||||||
warnings.warn("is_in_tuple() is obsolete and will be removed",
|
|
||||||
DeprecationWarning, 2)
|
|
||||||
|
|
||||||
def is_namespace(self):
|
def is_namespace(self):
|
||||||
"""Returns true if name binding introduces new namespace.
|
"""Returns true if name binding introduces new namespace.
|
||||||
|
|
||||||
|
|
|
@ -55,22 +55,6 @@ class SymtableTest(unittest.TestCase):
|
||||||
internal = find_block(spam, "internal")
|
internal = find_block(spam, "internal")
|
||||||
foo = find_block(top, "foo")
|
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.check_warnings() 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):
|
def test_type(self):
|
||||||
self.assertEqual(self.top.get_type(), "module")
|
self.assertEqual(self.top.get_type(), "module")
|
||||||
self.assertEqual(self.Mine.get_type(), "class")
|
self.assertEqual(self.Mine.get_type(), "class")
|
||||||
|
|
|
@ -165,6 +165,10 @@ Core and Builtins
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Deprecated methods of symtable.Symbol have been removed: is_keywordarg(),
|
||||||
|
is_vararg(), and is_in_tuple().
|
||||||
|
|
||||||
- Issue #5316: Fixed buildbot failures introduced by multiple inheritance
|
- Issue #5316: Fixed buildbot failures introduced by multiple inheritance
|
||||||
in Distutils tests.
|
in Distutils tests.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue