Skip to content

Loading…

regression test that normally will segfault in the absence of the +1 mem... #67

Merged
merged 1 commit into from

2 participants

@rogerhu

...ory allocation bug in inclusive ns prefixes

@scoder scoder merged commit 0a913d3 into lxml:master
@scoder
lxml member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. @rogerhu

    regression test that normally will segfault in the absence of the +1 …

    rogerhu committed
    …memory allocation bug in inclusive ns prefixes
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/lxml/tests/test_etree.py
View
9 src/lxml/tests/test_etree.py
@@ -3418,6 +3418,15 @@ def test_c14n_element_tostring_exclusive(self):
self.assertEquals(_bytes('<z:b xmlns:y="http://bcd" xmlns:z="http://cde"></z:b>'),
s)
+ def test_c14n_tostring_inclusive_ns_prefixes(self):
+ """ Regression test to fix memory allocation issues (use 3+ inclusive NS spaces)"""
+ tree = self.parse(_bytes(
+ '<a xmlns:x="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b/></a>'))
+
+ s = etree.tostring(tree, method='c14n', exclusive=True, inclusive_ns_prefixes=['x', 'y', 'z'])
+ self.assertEquals(_bytes('<a xmlns:x="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'),
+ s)
+
class ETreeWriteTestCase(HelperTestCase):
def test_write(self):
Something went wrong with that request. Please try again.