Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
24c926f1
Commit
24c926f1
authored
Aug 20, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert 65897
parent
10fe57ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
16 deletions
+13
-16
Doc/library/symtable.rst
Doc/library/symtable.rst
+5
-5
Lib/symtable.py
Lib/symtable.py
+3
-3
Lib/test/test_symtable.py
Lib/test/test_symtable.py
+5
-5
Misc/NEWS
Misc/NEWS
+0
-3
No files found.
Doc/library/symtable.rst
View file @
24c926f1
...
@@ -95,19 +95,19 @@ Examining Symbol Tables
...
@@ -95,19 +95,19 @@ Examining Symbol Tables
.. method:: get_parameters()
.. method:: get_parameters()
Return a
set
containing names of parameters to this function.
Return a
tuple
containing names of parameters to this function.
.. method:: get_locals()
.. method:: get_locals()
Return a
set
containing names of locals in this function.
Return a
tuple
containing names of locals in this function.
.. method:: get_globals()
.. method:: get_globals()
Return a
set
containing names of globals in this function.
Return a
tuple
containing names of globals in this function.
.. method:: get_frees()
.. method:: get_frees()
Return a
set
containing names of free variables in this function.
Return a
tuple
containing names of free variables in this function.
.. class:: Class
.. class:: Class
...
@@ -116,7 +116,7 @@ Examining Symbol Tables
...
@@ -116,7 +116,7 @@ Examining Symbol Tables
.. method:: get_methods()
.. method:: get_methods()
Return a
set
containing the names of methods declared in the class.
Return a
tuple
containing the names of methods declared in the class.
.. class:: Symbol
.. class:: Symbol
...
...
Lib/symtable.py
View file @
24c926f1
...
@@ -128,8 +128,8 @@ class Function(SymbolTable):
...
@@ -128,8 +128,8 @@ class Function(SymbolTable):
__globals
=
None
__globals
=
None
def
__idents_matching
(
self
,
test_func
):
def
__idents_matching
(
self
,
test_func
):
return
frozenset
(
ident
for
ident
in
self
.
get_identifiers
()
return
tuple
([
ident
for
ident
in
self
.
get_identifiers
()
if
test_func
(
self
.
_table
.
symbols
[
ident
])
)
if
test_func
(
self
.
_table
.
symbols
[
ident
])]
)
def
get_parameters
(
self
):
def
get_parameters
(
self
):
if
self
.
__params
is
None
:
if
self
.
__params
is
None
:
...
@@ -164,7 +164,7 @@ class Class(SymbolTable):
...
@@ -164,7 +164,7 @@ class Class(SymbolTable):
d
=
{}
d
=
{}
for
st
in
self
.
_table
.
children
:
for
st
in
self
.
_table
.
children
:
d
[
st
.
name
]
=
1
d
[
st
.
name
]
=
1
self
.
__methods
=
frozenset
(
d
)
self
.
__methods
=
tuple
(
d
)
return
self
.
__methods
return
self
.
__methods
...
...
Lib/test/test_symtable.py
View file @
24c926f1
...
@@ -80,11 +80,11 @@ class SymtableTest(unittest.TestCase):
...
@@ -80,11 +80,11 @@ class SymtableTest(unittest.TestCase):
def
test_function_info
(
self
):
def
test_function_info
(
self
):
func
=
self
.
spam
func
=
self
.
spam
self
.
assertEqual
(
func
.
get_parameters
(),
{
"a"
,
"b"
,
"kw"
,
"var"
}
)
self
.
assertEqual
(
func
.
get_parameters
(),
(
"a"
,
"b"
,
"kw"
,
"var"
)
)
self
.
assertEqual
(
func
.
get_locals
(),
self
.
assertEqual
(
func
.
get_locals
(),
{
"a"
,
"b"
,
"bar"
,
"glob"
,
"internal"
,
"kw"
,
"var"
,
"x"
}
)
(
"a"
,
"b"
,
"bar"
,
"glob"
,
"internal"
,
"kw"
,
"var"
,
"x"
)
)
self
.
assertEqual
(
func
.
get_globals
(),
{
"bar"
,
"glob"
}
)
self
.
assertEqual
(
func
.
get_globals
(),
(
"bar"
,
"glob"
)
)
self
.
assertEqual
(
self
.
internal
.
get_frees
(),
{
"x"
}
)
self
.
assertEqual
(
self
.
internal
.
get_frees
(),
(
"x"
,)
)
def
test_globals
(
self
):
def
test_globals
(
self
):
self
.
assertTrue
(
self
.
spam
.
lookup
(
"glob"
).
is_global
())
self
.
assertTrue
(
self
.
spam
.
lookup
(
"glob"
).
is_global
())
...
@@ -142,7 +142,7 @@ class SymtableTest(unittest.TestCase):
...
@@ -142,7 +142,7 @@ class SymtableTest(unittest.TestCase):
self
.
assertEqual
(
self
.
Mine
.
get_name
(),
"Mine"
)
self
.
assertEqual
(
self
.
Mine
.
get_name
(),
"Mine"
)
def
test_class_info
(
self
):
def
test_class_info
(
self
):
self
.
assertEqual
(
self
.
Mine
.
get_methods
(),
{
'a_method'
}
)
self
.
assertEqual
(
self
.
Mine
.
get_methods
(),
(
'a_method'
,)
)
def
test_filename_correct
(
self
):
def
test_filename_correct
(
self
):
### Bug tickler: SyntaxError file name correct whether error raised
### Bug tickler: SyntaxError file name correct whether error raised
...
...
Misc/NEWS
View file @
24c926f1
...
@@ -249,9 +249,6 @@ Extension Modules
...
@@ -249,9 +249,6 @@ Extension Modules
Library
Library
-------
-------
- symtable.Function's ``get_locals()``, ``get_globals()``, ``get_parameters()``,
and ``get_frees()`` and symtable.Class's ``get_methods()`` now return sets.
- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
symtable.Symbol have been removed.
symtable.Symbol have been removed.
...
...
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