Repository navigation
Small filter and lexer parity: ordering over None, select/reject binding, fold by choice, \N{name} (0045, 0295, 0291, 0041) - #646
Merged
Conversation
- 0045: min, max, dictsort and groupby reject None (TypeError) and an undefined
key (UndefinedError under every Undefined class), as Python's `<` does.
- 0295: select/reject/selectattr/rejectattr bind as select_or_reject: the
attribute and test name only by position, the rest to the test, nothing
without a test; a missing attribute fails at the first item.
- 0291: a value folds by the side a foldable test or and/or operand picks.
PrepareFold records it in one Load walk; the finalize and volatile renderers
decide it at render with IsFoldableAt. Nested choices are filed as 0304.
- 0041: \N{name} escapes through a generated Unicode 15.0 name and alias table
(scripts/gen_unicode_names.py, checked in CI), behind
JINJA2CPP_WITH_UNICODE_NAMES (default ON).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ
…ectattr(undefined)
- unicode_names.cpp compares name keys as std::vector<uint8_t>: libc++ 19 drops
char_traits<unsigned char>, which basic_string<uint8_t> needed.
- With JINJA2CPP_WITH_UNICODE_NAMES=OFF the tests skip the \N{} expectations.
- selectattr/rejectattr look up an undefined attribute name (finding nothing),
as Python does; None still means the item itself.
- File 0305: divisibleby of a str (found by the verifier), pinned by
tests.divisibleby_string.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ
…n PRs) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ
Member
Author
|
@codex review @codex security review Generated by Claude Code |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
rmorozov
marked this pull request as ready for review
October 24, 2026 18:47
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ
rmorozov
pushed a commit
that referenced
this pull request
Oct 24, 2026
At the merge steward's request (#646, #647, #649 merged). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UQ5fopVvhaFveMqaxcKYeK
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.
Requested by Ruslan · project thread
Parity thread P5 of the 2026-10-24 batch: four small gaps, each with corpus cases, all checked against Jinja2 3.1.6 on Python 3.12.
Problem and resulting behaviour
CompareForOrderletNoneand undefined operands through. Nowmin,max,dictsort(key and value) andgroupbyraise TypeError forNoneand UndefinedError for an undefined key under every Undefined class, as Python's<does. A single item still needs no comparison ([none]|minisNone).Testernow binds asselect_or_reject: the attribute and the test name only by position, every other argument (keywords included) to the test, and none at all when there is no test. A missing attribute fails lazily at the first item. User-visible:selectattr(attribute='x')was a Jinja2C++-only spelling and is now an error, as in Python. The two unit rows that used it pass the attribute by position. Also, an undefined attribute name now finds nothing, as in Python, whileNonestill means the item itself.a if test else bandand/orby the side a foldable test picks. The newExpression::PrepareFolddoes one Load walk and records, per operand, whether it folds always or by choice.IsFoldableAtevaluates those tests at render time; foldable tests are constants, so they have the same value Jinja2 folds.FinalizedExpressionRenderer(finalize ordering, 0288) andStaticOutputRenderer(volatile code, 0216) use it. A choice nested in a~chain or another composite is filed as 0307, pinned byautoescape.volatile_folded_choice_nested.\N{name}escapes. These are now decoded from a generated Unicode 15.0 name and alias table:src/unicode_names.h, fromscripts/gen_unicode_names.pyandscripts/unicode_name_aliases.txt, checked in parity-expectations.yml. Lookup matches CPython's: stored names and aliases in any ASCII case, computed CJK unified and Hangul names only as spelled. The table is about 450 KB of read-only data, with a sorted index so each lookup takes about 1 µs. New CMake optionJINJA2CPP_WITH_UNICODE_NAMES(default ON, Ruslan's choice in the thread); with OFF, a\N{}escape is a parse error and the tests skip those expectations.detail::LookupUnicodeNameisJINJA2CPP_EXPORTso that tests can decode escapes in shared builds; an added symbol only.'a' is divisibleby 2answers False where Python raises. Pinned bytests.divisibleby_string.Validation
ctest5/5, parity 2092 cases with the new lines removed fromdivergences/{autoescape,literals}.txt.generate.py --checkandgen_unicode_names.py --checkpass under Python 3.12.unicode-escapecodec: 0 mismatches. The verifier separately compared 163k + 59k names, including mutated ones: 0 mismatches.scripts/preflight.sh --perfpasses the instruction gate, and the perf track approved it (job 120893827560). The largest change is Load/strings at +0.24%; every Render benchmark is unchanged.Testerconstructor'sleadParams.posParamsvector. It holds the attribute and test-name arguments split off forParseParams, and is built once perselect/selectattrcall site at Load (selectattr("role", "equalto", "user")andselect('ne', 'the')in those templates). It is not on the render path.JINJA2CPP_WITH_UNICODE_NAMES=OFFRelease build has ctest 5/5.Process
#include <exception>and test-line formatting; preflight had already caught both before any push. Its non-blocking findings were also fixed:basic_string<uint8_t>would break on libc++ 19, the OFF build failed tests, andselectattr(undefined)was wrong. It also checked ASan+UBSan with clang (5/5, clean), a shared build (links, 5/5), linearPrepareFoldon deep chains, and that IsFoldableAt'sstd::exceptioncatch loses no limit error, since the normal evaluation rethrows.src/filters.cppandsrc/renderer.h.🤖 Generated with Claude Code
https://claude.ai/code/session_015FP4qroXpXbNJdUJrvfJVQ