diff options
author | Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> | 2022-03-08 08:26:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 08:26:13 (GMT) |
commit | 591f6754b56cb7f6c31fce8c22528bdf0a99556c (patch) | |
tree | 8f3914aa35e86201d09e4abf48edbc784ac6176d /Misc | |
parent | 4d95fa1ac5d31ff450fb2f31b55ce1eb99d6efcb (diff) | |
download | cpython-591f6754b56cb7f6c31fce8c22528bdf0a99556c.zip cpython-591f6754b56cb7f6c31fce8c22528bdf0a99556c.tar.gz cpython-591f6754b56cb7f6c31fce8c22528bdf0a99556c.tar.bz2 |
bpo-40059: Add tomllib (PEP-680) (GH-31498)
This adds a new standard library module, `tomllib`, for parsing TOML.
The implementation is based on Tomli (https://github.com/hukkin/tomli).
## Steps taken (converting `tomli` to `tomllib`)
- Move everything in `tomli:src/tomli` to `Lib/tomllib`. Exclude `py.typed`.
- Remove `__version__ = ...` line from `Lib/tomllib/__init__.py`
- Move everything in `tomli:tests` to `Lib/test/test_tomllib`. Exclude the following test data dirs recursively:
- `tomli:tests/data/invalid/_external/`
- `tomli:tests/data/valid/_external/`
- Create `Lib/test/test_tomllib/__main__.py`:
```python
import unittest
from . import load_tests
unittest.main()
```
- Add the following to `Lib/test/test_tomllib/__init__.py`:
```python
import os
from test.support import load_package_tests
def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)
```
Also change `import tomli as tomllib` to `import tomllib`.
- In `cpython/Lib/tomllib/_parser.py` replace `__fp` with `fp` and `__s` with
`s`. Add the `/` to `load` and `loads` function signatures.
- Run `make regen-stdlib-module-names`
- Create `Doc/library/tomllib.rst` and reference it in `Doc/library/fileformats.rst`
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-02-23-01-11-08.bpo-40059.Iwc9UH.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-02-23-01-11-08.bpo-40059.Iwc9UH.rst b/Misc/NEWS.d/next/Library/2022-02-23-01-11-08.bpo-40059.Iwc9UH.rst new file mode 100644 index 0000000..d41ff13 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-02-23-01-11-08.bpo-40059.Iwc9UH.rst @@ -0,0 +1 @@ +:pep:`680`, the :mod:`tomllib` module. Adds support for parsing TOML. |