Repository navigation
parity(0047): JSON null is None, undefined prints Undefined in containers - #494
Merged
Merged
Conversation
…ide containers and pprint 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
…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
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:
{"x": null}from a JSON binding gavejson.x is definedfalse and printed empty.{{ [nope, 1] }},{{ dict(a=nope) }}and{{ nope|pprint }}printedNoneornonewhere Python printsUndefined.After: a JSON null is present and is
None(json.x is definedtrue, printsNone). Undefined inside a container and underpprintprintsUndefined. 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, andGenericMapAdapter::GetItemthen turns an emptyValuefrom a present item intoNone. Reflected struct fields keep reading as undefined, so themap(attribute=, default=)convention is unchanged.HasValuecould not carry this, since a reflected struct reports every declared field as present. TheMakeUndefinedguard stays for the same reason. TheValueRendererrepr andPrettyPrinternow printUndefined.Tests: removes 3 lines from
test/parity/divergences/undefined.txt;NullMemberIsNonein the boost, nlohmann and rapid binding tests (rapid built locally with the patched pinned RapidJSON); 4 unit rows that encodednonefor undefined inforloop_test.cppandfilters_test.cpp.Follow-up filed: 0173 (
pprintprintsnone/truewhere Python printsNone/True).Roles: verifier, 1 round, no blocking findings (clang ASan+UBSan, nlohmann config, 80-template Python oracle check,
preflight.sh --perfall clean). Red pushes: none so far.🤖 Generated with Claude Code
https://claude.ai/code/session_011DkJzm2CJsYbt4dmQT5uYZ