Skip to content

Load YAML values like 10:30 as strings instead of base 60 numbers - #1008

Merged
mauvilsa merged 1 commit into
mainfrom
yaml-no-sexagesimal-numbers
Oct 8, 2026
Merged

mauvilsa merged 1 commit into
mainfrom
yaml-no-sexagesimal-numbers

Conversation

@mauvilsa

@mauvilsa mauvilsa commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

PyYAML implements YAML 1.1, which resolves values like 10:30 and 10:30:00.5 as sexagesimal (base 60) numbers, i.e. 630 and 37800.5. Because of this, times could not be parsed as datetime.time when given in a config file or inside a list, and with Union[int, time] they silently became integers.

This pull request removes the sexagesimal resolution from the default YAML loader, so such values are loaded as strings, as in YAML 1.2. Other number formats are not changed.

Before submitting

  • Did you read the contributing guideline?
  • If you used a coding agent, did you fully understand and validate all generated code and ensure it follows the contributing guidelines?
  • Did you update the documentation? (readme and public docstrings)
  • Did you write unit tests such that there is 100% coverage on related code? (required for bug fixes and new features)
  • Did you verify that new and existing tests pass locally?
  • If this is a bug fix, did you verify that the tests fail without the code fix?
  • Did you make sure that all changes preserve backward compatibility?
  • Did you update the CHANGELOG including a pull request link? (not for typos, docs, test updates, or minor internal changes/refactors)

@mauvilsa mauvilsa added bug Something isn't working refactor Improvements to the quality of the code labels Oct 8, 2026
@mauvilsa
mauvilsa deployed to sonarcloud October 8, 2026 06:41 — with GitHub Actions Active
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes how YAML parses time-like and base 60 number values.

This PR appears safe to merge.

What we checked:

  • Other YAML loaders stay unchanged: remove_implicit_resolver copies the inherited dictionary and replaces its lists before adding the new patterns.

Summary

YAML values such as 10:30 and 10:30:00.5 now load as strings instead of base 60 numbers.

  • This lets unquoted time values work in lists and configuration text.
  • The change keeps ordinary integer and float forms.
  • Tests, documentation, and the changelog describe the new behavior.

No actionable issues were found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "Load YAML values like 10:30 as strings i..." · Reviewed by Greptile

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f4b420a) to head (71be412).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1008   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         9798      9800    +2     
=========================================
+ Hits          9798      9800    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@mauvilsa
mauvilsa merged commit b1bd6c8 into main Oct 8, 2026
33 checks passed
@mauvilsa
mauvilsa deleted the yaml-no-sexagesimal-numbers branch October 8, 2026 06:44

This branch was successfully deployed

1 active deployment
sonarcloud — 71be4122 Deployed Oct 8, 2026 by mauvilsa via sonarcloud #957
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working refactor Improvements to the quality of the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant