diff options
| author | syfyra <258908070+syfyra@users.noreply.github.com> | 2026-11-26 10:44:43 +0100 |
|---|---|---|
| committer | syfyra <258908070+syfyra@users.noreply.github.com> | 2026-11-26 10:44:47 +0100 |
| commit | 21d1f0ceb890f118e6a20614c0304283ab859a0a (patch) | |
| tree | 8cbeca004e509b2dd36b293dfd8f84d94e9b4ab2 /tests/test_run_gpu_tests_python_assembler.py | |
| parent | a73a57e1339be072baf5522351c8ec7f1482b56b (diff) | |
tests: support.py compiles the translator from pieces, 7 s -> 1 s per uncached import (TEST-TRANSLATOR-PIECEWISE-PARSE)
On CPython 3.12.0 to 3.14.7 the tokenizer copies the rest of its input at
every f-string field (update_fstring_expr: strlen, PyMem_Malloc, strncpy),
and import hands a module over as one string, so compiling the 1.2 MB
tools/rdna2spirv.py takes 7 s, 0.1 s of it code generation. CPython fixed it
in 3.14.8 and 3.15.0 (gh-155525); 3.12, which CI pins, keeps it.
tests/semantic/piecewise_parse.py finds statement starts with tokenize,
parses top-level statements in pieces of 300 lines (a longer class is cut
between the statements of its body) with one newline in front for every line
before the piece, and joins them into the tree a whole-file parse gives.
Whatever does not fit returns None and the source is compiled the usual way.
tests/semantic/support.py loads the modules of TOOLS_DIR through a
SourceFileLoader subclass that compiles that tree, by a sys.meta_path finder
placed just before PathFinder, only on the interpreters above. A valid .pyc
is still used first.
tests/test_piecewise_parse.py compares the trees for every Python file of
the repository, hand-written boundary cases, the exceptions and warnings
against compile(), and code objects against compile(bytes).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_run_gpu_tests_python_assembler.py')
0 files changed, 0 insertions, 0 deletions