diff options
author | Eli Bendersky <eliben@gmail.com> | 2013-09-13 13:27:52 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2013-09-13 13:27:52 (GMT) |
commit | 12f18289c0481ffc1731dfa606baa9f65baa6478 (patch) | |
tree | 364a35e743014a69b2015e5e1a3c29e8af916321 /Lib | |
parent | 7290608af78240a2d02eecf3dcf04adbb5617f93 (diff) | |
parent | 61f4cd1dd534b33346a1290a1fe0ad3e71205e94 (diff) | |
download | cpython-12f18289c0481ffc1731dfa606baa9f65baa6478.zip cpython-12f18289c0481ffc1731dfa606baa9f65baa6478.tar.gz cpython-12f18289c0481ffc1731dfa606baa9f65baa6478.tar.bz2 |
Merge for Issue #18997: Issue #18997: fix ElementTree crash with using pickle and __getstate__.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_xml_etree.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 8cc50a1..a888fe5 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1697,6 +1697,18 @@ class BasicElementTest(ElementTestCase, unittest.TestCase): self.assertEqual(len(e2), 2) self.assertEqualElements(e, e2) + def test_pickle_issue18997(self): + for dumper, loader in product(self.modules, repeat=2): + XMLTEXT = """<?xml version="1.0"?> + <group><dogs>4</dogs> + </group>""" + e1 = dumper.fromstring(XMLTEXT) + if hasattr(e1, '__getstate__'): + self.assertEqual(e1.__getstate__()['tag'], 'group') + e2 = self.pickleRoundTrip(e1, 'xml.etree.ElementTree', dumper, loader) + self.assertEqual(e2.tag, 'group') + self.assertEqual(e2[0].tag, 'dogs') + class ElementTreeTypeTest(unittest.TestCase): def test_istype(self): |