From bfec7344e1daa901e590bb6bd0093ea7a29f26fe Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 30 Jan 2026 18:05:40 +0100 Subject: [PATCH 1/2] Add What's New entry with the changes --- Doc/library/tomllib.rst | 8 ++++--- Doc/whatsnew/3.15.rst | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) 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..2d5ad6df6c2030 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -798,6 +798,55 @@ 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.1 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 ------ From 82f5a1aebda73c48568ee8e23108238469c3d967 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 30 Jan 2026 19:04:53 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Taneli Hukkinen Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/whatsnew/3.15.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 2d5ad6df6c2030..a2a98c7ff2106b 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -815,7 +815,7 @@ tomllib 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.1 support in Pygments, + .. syntax highlighting needs TOML 1.1.0 support in Pygments, see https://github.com/pygments/pygments/issues/3026 .. code-block:: text @@ -847,6 +847,7 @@ tomllib .. _official TOML changelog: https://github.com/toml-lang/toml/blob/main/CHANGELOG.md + types ------