Skip to content

parity(0047): JSON null is None, undefined prints Undefined in containers - #494

Merged
rmorozov merged 4 commits into
masterfrom
claude/project-thread-mrmxn8
Oct 12, 2026
Merged

rmorozov merged 4 commits into
masterfrom
claude/project-thread-mrmxn8

Conversation

@rmorozov

@rmorozov rmorozov commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Requested by Ruslan · project thread

Before: {"x": null} from a JSON binding gave json.x is defined false and printed empty. {{ [nope, 1] }}, {{ dict(a=nope) }} and {{ nope|pprint }} printed None or none where Python prints Undefined.

After: a JSON null is present and is None (json.x is defined true, prints None). Undefined inside a container and under pprint prints Undefined. Item 3 of the task was already done by 0019.

How: new non-pure virtual IMapItemAccessor::EmptyIsNone() (default false). The three JSON accessors return true, and GenericMapAdapter::GetItem then turns an empty Value from a present item into None. Reflected struct fields keep reading as undefined, so the map(attribute=, default=) convention is unchanged. HasValue could not carry this, since a reflected struct reports every declared field as present. The MakeUndefined guard stays for the same reason. The ValueRenderer repr and PrettyPrinter now print Undefined.

Tests: removes 3 lines from test/parity/divergences/undefined.txt; NullMemberIsNone in the boost, nlohmann and rapid binding tests (rapid built locally with the patched pinned RapidJSON); 4 unit rows that encoded none for undefined in forloop_test.cpp and filters_test.cpp.

Follow-up filed: 0173 (pprint prints none/true where Python prints None/True).

Roles: verifier, 1 round, no blocking findings (clang ASan+UBSan, nlohmann config, 80-template Python oracle check, preflight.sh --perf all clean). Red pushes: none so far.

🤖 Generated with Claude Code

https://claude.ai/code/session_011DkJzm2CJsYbt4dmQT5uYZ

…ide containers and pprint

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DkJzm2CJsYbt4dmQT5uYZ
@rmorozov rmorozov self-assigned this Oct 12, 2026
…n (0047)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DkJzm2CJsYbt4dmQT5uYZ
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DkJzm2CJsYbt4dmQT5uYZ
@rmorozov
rmorozov merged commit 70d090b into master Oct 12, 2026
41 checks passed
rmorozov added a commit that referenced this pull request Oct 12, 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.

2 participants