Skip to content

AI junk - #2250

Closed
TrueFurina wants to merge 1 commit into
pallets:mainfrom
TrueFurina:fix/escaped-test-undefined
Closed

AI junk#2250
TrueFurina wants to merge 1 commit into
pallets:mainfrom
TrueFurina:fix/escaped-test-undefined

Conversation

@TrueFurina

Copy link
Copy Markdown

Summary

Fixes #2244: with ChainableUndefined, parent.child is escaped incorrectly returns True for an undefined value. ChainableUndefined.__html__ exists (it returns str(self)), so test_escaped's hasattr(value, "__html__") check matches — but an undefined value is not escaped.

Changes

  • src/jinja2/tests.py: test_escaped now returns False for Undefined instances (hasattr(value, "__html__") and not isinstance(value, Undefined)). Undefined is already imported in this module.

Verification

  • ast.parse passes on both files
  • Local assertions:
    • ChainableUndefined(name="parent.child")is escaped is False (previously True; the issue's exact scenario)
    • Undefined()False
    • A real escaped value (e.g. SafeString with __html__) → True (unchanged)
    • Plain strFalse (unchanged)
  • Full jinja test suite not run locally (no jinja install in this environment); single-condition change

@davidism

Copy link
Copy Markdown
Member

@davidism davidism closed this Aug 29, 2026
@davidism davidism changed the title fix: is escaped is false for undefined values AI junk Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChainableUndefined causes is escaped test to pass for undefined child elements

2 participants