Repository navigation
test: pass the Python suite on PyPy 3.11 - #474
Merged
Merged
Conversation
Several tests relied on CPython behavior that PyPy does not share. Each now checks the capability it depends on: - The row HTML tests check whether markupsafe's C escaper is in use. Citry turns the row HTML writer on only then, so on PyPy they check the per-row output and skip the test that counts work the writer saves. A new test requires CPython to detect the C escaper, so CPython cannot quietly fall back to testing only the per-row path. - run_on_path skips a forced Rust run when the interpreter has no native render module, instead of failing inside Citry. - The f-string error test compares against the interpreter's own TypeError text. - The browser record stub test ignores the __dict__ and __weakref__ descriptors PyPy adds to classes built in Rust. - The i18n catalog test collects once more, since without reference counting the catalog is freed on the pass after its class. - The deep read set test still requires CPython to reject the deep function, and skips on an interpreter that compiles it, because Citry's fallback then never runs. - The concurrent Const test now pins the contract Citry documents: threads that render the same new Const values at once may each prepare the body, and every render shows the first body stored. A barrier makes the builds overlap on every run, so the test no longer depends on thread timing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With sandbox_expressions=False, Citry runs template expressions with
an empty __builtins__ mapping so they cannot call len or other
builtins, matching the sandbox. PyPy's eval finds builtins anyway, so
on PyPy a trusted template such as {{ len(items) }} renders with the
sandbox off, while CPython and the sandbox reject it.
The compatibility page (under a new "Differences on PyPy" heading),
the security page, and compile_expr now say so. The test that checks
builtins are hidden is split in two: the check that a template cannot
change the shared `__builtins__` mapping runs everywhere, and the
no-builtins check skips when the interpreter's eval still finds them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepares #264. The new weekly workflow runs the Python suite on PyPy 3.11 and free-threaded CPython 3.14. This PR fixes what failed on PyPy, so that workflow can start green.
What failed
A local run of
main(4ec0dd1) on PyPy 3.11.17 gave 45 failed, 13490 passed and 1039 skipped. The run used the same selection as CI, plus-v -rfE -o faulthandler_timeout=600. Free-threaded 3.14 already passed in CI. The hang seen in the first CI trial did not reproduce locally.test_simple_vue_row_html.pyrun_on_path(rust=True)turned the Rust path on even where it is unsupported.run_on_path, using the house reason.test_the_rust_path_is_on_where_it_is_supportedstill fails a broken CPython build.TypeErrordifferently.__dict__and__weakref__on Rust classes.gc.collect(); a real leak still fails.SyntaxError.performance/const.md). The oldcalls == 1test passed only by thread timing.evalfinds builtins even with an empty read-only__builtins__. Withsandbox_expressions=False, every builtin is available there.evalstill finds them.Docs
about/compatibility.md, in "Turn the sandbox off" onsecurity.md, and in thecompile_exprdocstring.{{ id }}, renders on PyPy instead of failing. I confirmed that by rendering through Citry on PyPy.Evidence
-n 4runs on each interpreter.eval.pypasses, default and--platform linux.docs_site/testsand thequalificationframe-budget tests. Neither is in the weekly workflow's selection.🤖 Generated with Claude Code