Conversation
StanFromIreland
left a comment
There was a problem hiding this comment.
I suggest you add tests for no seconds (e.g. https://github.com/python/cpython/pull/143028/changes#diff-1e0b41b99f172f0bfc84ace5d1d291fe25d3309217a7dd265c886a08cc4dca6dR3)
gpshead
pushed a commit
to gpshead/tomli
that referenced
this pull request
Dec 22, 2025
This adds new functions `loads_with_info()` and `load_with_info()` that
return a `ParseResult` containing:
- `data`: The parsed TOML data (same as before)
- `spec_version`: Minimum TOML spec version required ("1.0" or "1.1")
- `features`: Set of TOML 1.1 features used in the document
Currently detects the `\e` escape sequence (merged in PR hukkin#201) as a
TOML 1.1 feature. TODO comments mark where detection should be added
for pending TOML 1.1 features:
- `\xHH` hex escape (PR hukkin#202)
- Newlines/trailing commas in inline tables (PR hukkin#200)
- Optional seconds in datetime/time (PR hukkin#203)
The existing `loads()` and `load()` functions remain unchanged for
backward compatibility.
New public exports:
- `loads_with_info()`, `load_with_info()`: Parse with version info
- `ParseResult`: Frozen dataclass with parsing results
- `TOMLFeature`: Constants for TOML 1.1 feature identifiers
Addresses: hukkin#273
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #203 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 530 532 +2
Branches 99 99
=========================================
+ Hits 530 532 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Update tests and merge when toml-lang/toml#894 makes it into a TOML release.