Repository navigation
Conversation
|
This is too big a change to review in one step. Adding support for comments should not be done in the same batch as moving and altering the core parser to such an extent. It also makes this much more difficult to review.
Can you elaborate? Do you have some benchmarks to share? Why does placing the current parser in a header file speed it up? |
Preserve a slash that starts neither a line nor a block comment so the normal parser rejects it at its original position instead of skipping it. Cover decode, Decoder.decode, and decode_lines with both trailing-comma settings, Raw values, skipped fields, and valid comment boundaries.
|
Thanks for looking. You're right that this is too much for one review. On the header: it doesn't make the parser faster. It's a template. To make this reviewable, I'd like to close this PR and split it:
Does that split work for you, or would you prefer a different order? |
Adds explicit, independent
allow_commentsandallow_trailing_commasoptions tomsgspec.json.decodeandDecoderfor configuration files discussed in #1078. Defaults retain strict JSON syntax; the existingstrictoption retains its type-coercion meaning. Both comment forms, JSONC line endings, typed decoding, Raw, skipped unknown values anddecode_linesuse the same syntax implementation. Encoding and formatting retain their existing behavior.The implementation places syntax code in a single 2,494-line private header and compiles strict and comment-enabled recursive closures. This replaces an initial implementation that measurably slowed default decoding. The strict expansion excludes comment/slash checks, and
decode_linesselects its closure once. The source distribution explicitly includes the header.AI disclosure: the changes, tests and design work were generated with Codex and Luna agents. Two independent agents reviewed code and C input handling; these are AI reviews, not human review or sanitizer results.
Validation on CPython 3.12 / macOS arm64:
just test-typing,just check, andjust doc-buildpassed. No checks or skip rules were weakened.Benchmark.runand deterministic Directory data at 10 and 1,000 objects, typed and untyped. The earlier 9–11% default-path regressions did not recur. These limited, noisy wall-time observations do not establish a general speedup or a CodSpeed result.This remains a draft while original CI, sanitizer validation and the upstream CodSpeed gate are pending. The native artifacts used for validation are development snapshots; no upstream package release has been made.
Refs #1078.