Skip to content

Handle circular values without crashing the Go process - #31

Closed
qoke wants to merge 2 commits into
ardanlabs:mainfrom
iqhive:jinjafix-circular-values
Closed

qoke wants to merge 2 commits into
ardanlabs:mainfrom
iqhive:jinjafix-circular-values

Conversation

@qoke

@qoke qoke commented Oct 22, 2026

Copy link
Copy Markdown

Closes #15.

Rendering a dictionary that references itself could recurse indefinitely and crash the Go process. Recursive containers now render with Python-style markers, such as {'self': {...}}. Circular JSON serialisation returns a controlled error, and comparing a container with itself no longer recurses through its contents.

The renderer tracks containers along the current traversal path rather than everything it has already seen. That distinction keeps shared references working when they aren’t circular.

Regression coverage captures the Python reference output and the failing Go behaviour, then verifies recursive dictionary rendering, self-equality, and circular JSON errors with the fix applied.

@ardan-bkennedy

Copy link
Copy Markdown
Contributor

Thank you, @qoke, for reporting these issues and for providing proposed fixes. We reviewed all nine reports and used your suggestions where they made sense in the codebase. All nine issues have now been resolved in #34, each with corresponding regression tests, and the fixes are published in v1.11.0.

The issue addressed by this PR (#15) is covered by that release, so we are closing this PR in favor of the consolidated fix.

For future reports, please start with issues only so we can discuss the approach before opening pull requests. Thanks again for helping improve the project.

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.

Circular values can crash or hang rendering

2 participants