diff options
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r-- | Lib/test/test_xml_etree_c.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 71973ed..c48276a 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -4,6 +4,8 @@ import doctest import sys from test import support +from test.support import precisionbigmemtest, _2G +import unittest ET = support.import_module('xml.etree.cElementTree') @@ -212,9 +214,25 @@ def bug_1534630(): '<tag />' """ +class MiscTests(unittest.TestCase): + # Issue #8651. + @support.precisionbigmemtest(size=support._2G + 100, memuse=1) + def test_length_overflow(self, size): + if size < support._2G + 100: + self.skipTest("not enough free memory, need at least 2 GB") + data = b'x' * size + parser = ET.XMLParser() + try: + self.assertRaises(OverflowError, parser.feed, data) + finally: + data = None + + def test_main(): from test import test_xml_etree_c support.run_doctest(test_xml_etree_c, verbosity=True) + support.run_unittest(MiscTests) + if __name__ == '__main__': test_main() |