fix: parse YAML 1.2 octal scalars (0o prefix) as integers#1451
Merged
Conversation
3331445 to
2ca3378
Compare
Collaborator
|
@raphaelroshan thank you so much for tackling this issue! Comments:
|
SGSSGene
requested changes
Jun 24, 2026
SGSSGene
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this PR, see comment above.
2ca3378 to
f7b1554
Compare
f7b1554 to
79d9250
Compare
Contributor
Author
|
Thank you @SGSSGene for the review, have updated the signature, added a check to ensure its an octal digit and based on yaml 1.2 - leading +/- signs arent valid so did not add that in the regex check |
SGSSGene
approved these changes
Jul 2, 2026
SGSSGene
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR! looks great
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.
Fixes #1251.
YAML 1.2 writes octal as
0o17, butas<int>()failed on it because std::stringstream's octal parsing only understands the C-style0prefix.Normalize
0o/0Oto a leading0before the stream conversion, so both the 1.1 (0123) and 1.2 (0o123) spellings decode. Hex and decimal are unchanged. As per the discussion in the issue, adding a functionNormalizeOctalPrefixthat should help to support backward compatibility. Added a test covering octal, signed/unsigned, hex and decimal.Do let me know if i misinterpreted the behavior required!