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
11fa3ffc
Commit
11fa3ffc
authored
Sep 11, 2016
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
3dad1a5b
076366c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree.py
+8
-0
Lib/xml/etree/ElementTree.py
Lib/xml/etree/ElementTree.py
+11
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_xml_etree.py
View file @
11fa3ffc
...
...
@@ -409,6 +409,14 @@ class ElementTreeTest(unittest.TestCase):
self
.
assertEqual
(
ET
.
tostring
(
elem
),
b'<test testa="testval" testb="test1" testc="test2">aa</test>'
)
elem
=
ET
.
Element
(
'test'
)
elem
.
set
(
'a'
,
'
\
r
'
)
elem
.
set
(
'b'
,
'
\
r
\
n
'
)
elem
.
set
(
'c'
,
'
\
t
\
n
\
r
'
)
elem
.
set
(
'd'
,
'
\
n
\
n
'
)
self
.
assertEqual
(
ET
.
tostring
(
elem
),
b'<test a=" " b=" " c="	 " d=" " />'
)
def
test_makeelement
(
self
):
# Test makeelement handling.
...
...
Lib/xml/etree/ElementTree.py
View file @
11fa3ffc
...
...
@@ -1084,8 +1084,19 @@ def _escape_attrib(text):
text
=
text
.
replace
(
">"
,
">"
)
if
"
\
"
"
in
text
:
text
=
text
.
replace
(
"
\
"
"
,
"""
)
# The following business with carriage returns is to satisfy
# Section 2.11 of the XML specification, stating that
# CR or CR LN should be replaced with just LN
# http://www.w3.org/TR/REC-xml/#sec-line-ends
if
"
\
r
\
n
"
in
text
:
text
=
text
.
replace
(
"
\
r
\
n
"
,
"
\
n
"
)
if
"
\
r
"
in
text
:
text
=
text
.
replace
(
"
\
r
"
,
"
\
n
"
)
#The following four lines are issue 17582
if
"
\
n
"
in
text
:
text
=
text
.
replace
(
"
\
n
"
,
" "
)
if
"
\
t
"
in
text
:
text
=
text
.
replace
(
"
\
t
"
,
"	"
)
return
text
except
(
TypeError
,
AttributeError
):
_raise_serialization_error
(
text
)
...
...
Misc/NEWS
View file @
11fa3ffc
...
...
@@ -209,6 +209,9 @@ Library
- Issue #24594: Validates persist parameter when opening MSI database
- Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributes
(Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.)
- Issue #28047: Fixed calculation of line length used for the base64 CTE
in the new email policies.
...
...
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