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
67245a6e
Commit
67245a6e
authored
Mar 05, 2012
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14168: Check for presence of _attrs before accessing it.
parent
f1c42599
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
Lib/test/test_minidom.py
Lib/test/test_minidom.py
+12
-3
Lib/xml/dom/minidom.py
Lib/xml/dom/minidom.py
+4
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_minidom.py
View file @
67245a6e
...
...
@@ -362,11 +362,17 @@ class MinidomTest(unittest.TestCase):
def
testGetAttrList
(
self
):
pass
def
testGetAttrValues
(
self
):
pass
def
testGetAttrValues
(
self
):
pass
def
testGetAttrLength
(
self
):
pass
def
testGetAttrLength
(
self
):
pass
def
testGetAttribute
(
self
):
pass
def
testGetAttribute
(
self
):
dom
=
Document
()
child
=
dom
.
appendChild
(
dom
.
createElementNS
(
"http://www.python.org"
,
"python:abc"
))
self
.
assertEqual
(
child
.
getAttribute
(
'missing'
),
''
)
def
testGetAttributeNS
(
self
):
dom
=
Document
()
...
...
@@ -378,6 +384,9 @@ class MinidomTest(unittest.TestCase):
'http://www.python.org'
)
self
.
assertEqual
(
child
.
getAttributeNS
(
"http://www.w3.org"
,
"other"
),
''
)
child2
=
child
.
appendChild
(
dom
.
createElement
(
'abc'
))
self
.
assertEqual
(
child2
.
getAttributeNS
(
"http://www.python.org"
,
"missing"
),
''
)
def
testGetAttributeNode
(
self
):
pass
...
...
Lib/xml/dom/minidom.py
View file @
67245a6e
...
...
@@ -723,12 +723,16 @@ class Element(Node):
Node
.
unlink
(
self
)
def
getAttribute
(
self
,
attname
):
if
self
.
_attrs
is
None
:
return
""
try
:
return
self
.
_attrs
[
attname
].
value
except
KeyError
:
return
""
def
getAttributeNS
(
self
,
namespaceURI
,
localName
):
if
self
.
_attrsNS
is
None
:
return
""
try
:
return
self
.
_attrsNS
[(
namespaceURI
,
localName
)].
value
except
KeyError
:
...
...
Misc/NEWS
View file @
67245a6e
...
...
@@ -511,6 +511,8 @@ Core and Builtins
Library
-------
-
Issue
#
14168
:
Check
for
presence
of
_attrs
before
accessing
it
.
-
Issue
#
14195
:
An
issue
that
caused
weakref
.
WeakSet
instances
to
incorrectly
return
True
for
a
WeakSet
instance
'a'
in
both
'a < a'
and
'a > a'
has
been
fixed
.
...
...
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