-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-142956: Update tomllib to parse TOML 1.1.0
#144243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hukkin
wants to merge
8
commits into
python:main
Choose a base branch
from
hukkin:toml-1.1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+128
−83
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f8275d4
tomllib: Add shorthand for escape character (TOML 1.1)
hukkin 2342380
tomllib: Allow newlines and trailing comma in inline tables (TOML 1.1)
hukkin 880092f
tomllib: Add \xHH Unicode escape code to basic strings (TOML 1.1)
hukkin 2199c58
tomllib: Make seconds optional in Date-Time and Time (TOML 1.1)
hukkin 329e049
tomllib: Sync with Tomli to reduce diff
hukkin b586d43
Add NEWS
hukkin 9ede2aa
Update docs
hukkin 3ccb26f
Add new test data folder to Makefile's list
hukkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
Lib/test/test_tomllib/data/valid/dates-and-times/datetimes.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| { | ||
| "local-dt": {"type":"datetime-local","value":"1988-10-27t01:01:01"}, | ||
| "local-dt-no-seconds": {"type":"datetime-local","value":"2025-04-18t20:05:00"}, | ||
| "zulu-dt": {"type":"datetime","value":"1988-10-27t01:01:01z"} | ||
| } |
1 change: 1 addition & 0 deletions
1
Lib/test/test_tomllib/data/valid/dates-and-times/datetimes.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| local-dt=1988-10-27t01:01:01 | ||
| local-dt-no-seconds=2025-04-18T20:05 | ||
| zulu-dt=1988-10-27t01:01:01z |
4 changes: 3 additions & 1 deletion
4
Lib/test/test_tomllib/data/valid/dates-and-times/localtime.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| {"t": | ||
| {"type":"time-local","value":"00:00:00.999999"}} | ||
| {"type":"time-local","value":"00:00:00.999999"}, | ||
| "t2": | ||
| {"type":"time-local","value":"00:00:00"}} |
3 changes: 2 additions & 1 deletion
3
Lib/test/test_tomllib/data/valid/dates-and-times/localtime.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| t=00:00:00.99999999999999 | ||
| t=00:00:00.99999999999999 | ||
| t2=00:00 |
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
Lib/test/test_tomllib/data/valid/inline-table/multiline-inline-table.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "multiline": { | ||
| "a": { | ||
| "type": "integer", | ||
| "value": "1" | ||
| }, | ||
| "b": { | ||
| "type": "integer", | ||
| "value": "2" | ||
| }, | ||
| "c": [ | ||
| { | ||
| "type": "integer", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "value": "2" | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "value": "3" | ||
| } | ||
| ], | ||
| "d": { | ||
| "type": "integer", | ||
| "value": "3" | ||
| }, | ||
| "e": { | ||
| "type": "integer", | ||
| "value": "4" | ||
| }, | ||
| "f": {} | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
Lib/test/test_tomllib/data/valid/inline-table/multiline-inline-table.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| multiline = { | ||
| "a" = 1, "b" = 2, | ||
| c = [ | ||
| 1, | ||
| 2, | ||
| 3, | ||
| ],# comment | ||
| d = 3, | ||
| e = 4, f = { | ||
| # comment | ||
| }, | ||
| } |
6 changes: 6 additions & 0 deletions
6
Lib/test/test_tomllib/data/valid/multiline-basic-str/replacements.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "escape": {"type":"string","value":"\u001B"}, | ||
| "tab": {"type":"string","value":"\t"}, | ||
| "upper-j": {"type":"string","value":"J"}, | ||
| "upper-j-2": {"type":"string","value":"J"} | ||
| } |
4 changes: 4 additions & 0 deletions
4
Lib/test/test_tomllib/data/valid/multiline-basic-str/replacements.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| escape = "\e" | ||
| tab = "\x09" | ||
| upper-j = "\x4a" | ||
| upper-j-2 = "\x4A" |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to elaborate changes between TOML 1.0 and TOML 1.1? Maybe just give some examples.
I suggest to document this change in What's New in Python 3.15.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I suggest: