Repository navigation
Call blocks: macro repr, repeated caller keyword, any call expression (0199) - #544
Merged
Merged
Conversation
… (0199)
A macro prints as <Macro 'm'> and a call block's caller as <Macro anonymous>
(its name is None). {% call m(caller=c) %} is a load error, as Python's
'keyword argument repeated: caller'. The call after 'call' is any call
expression, so ns.m() and l[0]() work; a non-call is rejected.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4CggH7f8SpGXEXrmTH97u
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4CggH7f8SpGXEXrmTH97u
…word column Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4CggH7f8SpGXEXrmTH97u
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4CggH7f8SpGXEXrmTH97u
rmorozov
marked this pull request as ready for review
October 17, 2026 12:47
rmorozov
added a commit
that referenced
this pull request
Oct 17, 2026
Train 16: parity 0199 leftovers (#544)
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
Before:
{{ caller }}and{{ m }}printed nothing,{% call m(caller=c) %}loaded and ran, and{% call ns.m() %}failed to parse ("Expected: '('").After: a macro prints as
<Macro 'm'>and a call block's caller as<Macro anonymous>(also inside lists, dicts and with autoescape), andcaller.nameis None.{% call m(caller=c) %}is a load error pointing atcaller, matching Python's "keyword argument repeated: caller".calltakes any call expression (ns.m(),l[0]()), and a non-call (m,m()|e,m() if a else b) is rejected as Jinja2's "expected call" does.How:
ParseCallparses the callee withExpressionParser::ParseFullExpressionand requires aCallExpression;MacroCallStatementholds that node and evaluates its callee at render instead of looking a name up by hash, so the callee is now an ordinary name use for the name resolver (onename_resolver_testrow updated).ValueRendererBaserendersCallable::Macrovalues with attributes; other callables still print nothing.Deliberate divergence: globals, Python methods and other non-macro callables print nothing, since Python's repr of them carries an address.
Parity: three 0199 divergence lines removed; eight new cases under
statements.py(attribute/item callee, rejected forms, innercaller=accepted, escaped repr,caller.name). Expectations regenerated under Python 3.12.Filed 0208 (macros as values:
pprint, equality/unique,truncate, call blocks passingcallerto callees that do not take it), pinned bystatements.macro_pprintandstatements.macro_equals_itself.Roles: verifier (1 round: one blocking finding, a missing
<optional>include caught by clang-tidy, already fixed before push; ASan+UBSan, fuzz replay over ~22k mutated call-block inputs and ~190 Python comparisons all clean). Perf gate: all benchmarks within +0.2%. Red pushes: none yet.Part of the parity merge train with 0201+0202, 0143+0198, 0200+0127.
Generated by Claude Code