Commit ff8ae30
committed
gh-155485: Skip test_subparser_inherits_reparse_deferral with Expat < 2.6.0
The test was added in 7d76013,
and fails when CPython is compiled against expat < 2.6.0:
test_subparser_inherits_reparse_deferral (test.test_pyexpat.ParentParserLifetimeTest.test_subparser_inherits_reparse_deferral) ... FAIL
======================================================================
FAIL: test_subparser_inherits_reparse_deferral (test.test_pyexpat.ParentParserLifetimeTest.test_subparser_inherits_reparse_deferral)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/Python-3.13.15/Lib/test/test_pyexpat.py", line 960, in test_subparser_inherits_reparse_deferral
self.assertEqual(subparser.GetReparseDeferralEnabled(), enabled)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False != True
----------------------------------------------------------------------
With XML_COMBINED_VERSION < 20600,
SetReparseDeferralEnabled is a complete no-op[1],
both the expat call and the cache update are inside #if XML_COMBINED_VERSION >= 20600.
The cache stays at its initial value of false[2],
which the subparser copies and GetReparseDeferralEnabled returns.
The test's enabled=True iteration then asserts False == True.
This is consistent with the documented behavior[3]:
GetReparseDeferralEnabled says "always returns false with Expat <2.6.0".
Hence, the test makes no sense on Expat < 2.6.0.
Similarly to gh-144739,
the test's skip decorator needs to check for the compile-time Expat version,
as the behavior is determined by #ifs, not by runtime capabilities.
Python compiled with Expat 2.5.x still fails the test
even if Expat was updated to 2.6.0+ on runtime.
We originally saw the test failure in EPEL 9
(has expat 2.5.0 with some security backports),
when we updated to Python 3.13.15.
I used LLM to analyze the cause of the test failure.
[1] https://github.com/python/cpython/blob/v3.15.0rc1/Modules/pyexpat.c#L847-L850
[2] https://github.com/python/cpython/blob/v3.15.0rc1/Modules/pyexpat.c#L1529
[3] https://github.com/python/cpython/blob/v3.15.0rc1/Modules/pyexpat.c#L858
Assisted-By: Claude Opus 4.61 parent a7541c3 commit ff8ae30
2 files changed
Lines changed: 11 additions & 0 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1045 | 1045 | | |
1046 | 1046 | | |
1047 | 1047 | | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1048 | 1055 | | |
1049 | 1056 | | |
1050 | 1057 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments