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
1a5e5de8
Commit
1a5e5de8
authored
Mar 14, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove get_prefix and set_prefix (#13248)
parent
7c466b4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
37 deletions
+2
-37
Lib/lib2to3/pytree.py
Lib/lib2to3/pytree.py
+0
-20
Lib/lib2to3/tests/test_pytree.py
Lib/lib2to3/tests/test_pytree.py
+0
-17
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/lib2to3/pytree.py
View file @
1a5e5de8
...
...
@@ -109,26 +109,6 @@ class Base(object):
"""
raise
NotImplementedError
def
set_prefix
(
self
,
prefix
):
"""
Set the prefix for the node (see Leaf class).
DEPRECATED; use the prefix property directly.
"""
warnings
.
warn
(
"set_prefix() is deprecated; use the prefix property"
,
DeprecationWarning
,
stacklevel
=
2
)
self
.
prefix
=
prefix
def
get_prefix
(
self
):
"""
Return the prefix for the node (see Leaf class).
DEPRECATED; use the prefix property directly.
"""
warnings
.
warn
(
"get_prefix() is deprecated; use the prefix property"
,
DeprecationWarning
,
stacklevel
=
2
)
return
self
.
prefix
def
replace
(
self
,
new
):
"""Replace this node with a new one in the parent."""
assert
self
.
parent
is
not
None
,
str
(
self
)
...
...
Lib/lib2to3/tests/test_pytree.py
View file @
1a5e5de8
...
...
@@ -31,23 +31,6 @@ class TestNodes(support.TestCase):
"""Unit tests for nodes (Base, Leaf, Node)."""
if
sys
.
version_info
>=
(
2
,
6
):
# warnings.catch_warnings is new in 2.6.
def
test_deprecated_prefix_methods
(
self
):
l
=
pytree
.
Leaf
(
100
,
"foo"
)
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
"always"
,
DeprecationWarning
)
self
.
assertEqual
(
l
.
get_prefix
(),
""
)
l
.
set_prefix
(
"hi"
)
self
.
assertEqual
(
l
.
prefix
,
"hi"
)
self
.
assertEqual
(
len
(
w
),
2
)
for
warning
in
w
:
self
.
assertTrue
(
warning
.
category
is
DeprecationWarning
)
self
.
assertEqual
(
str
(
w
[
0
].
message
),
"get_prefix() is deprecated; "
\
"use the prefix property"
)
self
.
assertEqual
(
str
(
w
[
1
].
message
),
"set_prefix() is deprecated; "
\
"use the prefix property"
)
def
test_instantiate_base
(
self
):
if
__debug__
:
# Test that instantiating Base() raises an AssertionError
...
...
Misc/NEWS
View file @
1a5e5de8
...
...
@@ -24,6 +24,8 @@ Core and Builtins
Library
-------
-
Issue
#
13248
:
Remove
lib2to3
.
pytree
.
Base
.
get_prefix
/
set_prefix
.
-
Issue
#
14234
:
CVE
-
2012
-
0876
:
Randomize
hashes
of
xml
attributes
in
the
hash
table
internal
to
the
pyexpat
module
's copy of the expat library to avoid a
denial of service due to hash collisions. Patch by David Malcolm with some
...
...
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