Skip to content

Commit 1138129

Browse files
youknowdotcodex
andauthored
Implement pyexpat character buffering and callback-safe flushes (#9838)
* Implement pyexpat character buffering and callback-safe flushes Port the Python-facing buffer API and flush ordering from CPython 3.15.2, preserve external parser configuration, and stop callbacks coherently on handler exceptions. Enable three canonical tests and extend existing pyexpat regressions without manufacturing backend event boundaries. Assisted-by: OpenAI Codex:GPT-6.1 * Guard callback-safe pyexpat regressions on older CPython hosts CPython 3.15.0 retains pending character data during callbacks. Keep callback mutation regressions enabled on RustPython and fixed CPython, without skipping common buffer APIs or exception propagation. Assisted-by: OpenAI Codex:GPT-6.1 * Route XML declaration callbacks through buffered error cleanup Preserve callback abort semantics when integrating the native encoding changes from main. Assisted-by: OpenAI Codex --------- Co-authored-by: Codex <[email protected]>
1 parent a6ac088 commit 1138129

3 files changed

Lines changed: 486 additions & 74 deletions

File tree

‎Lib/test/test_pyexpat.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ def test_default_to_disabled(self):
506506
parser = expat.ParserCreate()
507507
self.assertFalse(parser.buffer_text)
508508

509-
@unittest.expectedFailure # TODO: RUSTPYTHON
510509
def test_buffering_enabled(self):
511510
# Make sure buffering is turned on
512511
self.assertTrue(self.parser.buffer_text)
@@ -524,7 +523,6 @@ def test1(self):
524523
["<a>", "1", "<b>", "2", "\n", "3", "<c>", "4\n5"],
525524
"buffering control not reacting as expected")
526525

527-
@unittest.expectedFailure # TODO: RUSTPYTHON
528526
def test2(self):
529527
self.parser.Parse(b"<a>1<b/>&lt;2&gt;<c/>&#32;\n&#x20;3</a>", True)
530528
self.assertEqual(self.stuff, ["1<2> \n 3"],
@@ -732,7 +730,6 @@ def test_1025_bytes(self):
732730
def test_1000_bytes(self):
733731
self.assertEqual(self.small_buffer_test(1000), 1)
734732

735-
@unittest.expectedFailure # TODO: RUSTPYTHON
736733
def test_wrong_size(self):
737734
parser = expat.ParserCreate()
738735
parser.buffer_text = 1

0 commit comments

Comments
 (0)