diff --git a/Doc/library/tomllib.rst b/Doc/library/tomllib.rst index 237881e5f14545..d3767798055da4 100644 --- a/Doc/library/tomllib.rst +++ b/Doc/library/tomllib.rst @@ -4,8 +4,6 @@ .. module:: tomllib :synopsis: Parse TOML files. -.. versionadded:: 3.11 - .. moduleauthor:: Taneli Hukkinen .. sectionauthor:: Taneli Hukkinen @@ -17,8 +15,12 @@ This module provides an interface for parsing TOML 1.1.0 (Tom's Obvious Minimal Language, `https://toml.io `_). This module does not support writing TOML. +.. versionadded:: 3.11 + The module was added with support for TOML 1.0.0. + .. versionchanged:: next - Module updated to support TOML 1.1.0. Initially the module supported TOML 1.0.0. + Added TOML 1.1.0 support. + See the :ref:`What's New ` for details. .. seealso:: diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 8c92ac8e0319da..a2a98c7ff2106b 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -798,6 +798,56 @@ tkinter with outdated names. (Contributed by Serhiy Storchaka in :gh:`143754`) + +.. _whatsnew315-tomllib-1-1-0: + +tomllib +------- + +* The :mod:`tomllib` module now supports TOML 1.1.0. + This is a backwards compatible update, meaning that all valid TOML 1.0.0 + documents are parsed the same way. + + The changes, according to the `official TOML changelog`_, are: + + - Allow newlines and trailing commas in inline tables. + + Previously an inline table had to be on a single line and couldn't end + with a trailing comma. This is now relaxed so that the following is valid: + + .. syntax highlighting needs TOML 1.1.0 support in Pygments, + see https://github.com/pygments/pygments/issues/3026 + + .. code-block:: text + + tbl = { + key = "a string", + moar-tbl = { + key = 1, + }, + } + + - Add ``\xHH`` notation to basic strings for codepoints under 255, + and the ``\e`` escape for the escape character: + + .. code-block:: text + + null = "null byte: \x00; letter a: \x61" + csi = "\e[" + + - Seconds in datetime and time values are now optional. + The following are now valid: + + .. code-block:: text + + dt = 2010-02-03 14:15 + t = 14:15 + + (Contributed by Taneli Hukkinen in :gh:`142956`.) + +.. _official TOML changelog: https://github.com/toml-lang/toml/blob/main/CHANGELOG.md + + types ------