Repository navigation
Conversation
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.
Issue #, if available:
Fixes #163
Description of changes:
Convert Ion containers to plain containers without eagerly calling
default()on each child. The existing JSON encoder then handles native Python values normally and dispatches nested Ion values through the existing Ion-specific conversions.This fixes the reported case of adding a native string to a loaded Ion struct, as well as native values in Ion lists and s-expressions. The struct conversion retains its existing
keys()/o[key]behavior for duplicate fields.Regression coverage includes native scalars and containers, alternating native/Ion nesting, special Ion values, native non-finite floats and
allow_nan, dictionary keys andskipkeys, unsupported values, duplicate fields, input preservation, and circular references. The production change is limited to the two container conversion expressions.Validation
pytest -q tests/test_json_encoder.py: 133 passed on CPython 3.9.6 (pure Python), 3.12.13 (C extension), and 3.14.6 (pure Python).git diff --checkpassed.Implementation and local review were assisted by OpenAI Codex.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.