diff options
author | Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> | 2024-11-13 12:52:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-13 12:52:16 (GMT) |
commit | 29b5323c4567dc7772e1d30a7ba1cbad52fe10a9 (patch) | |
tree | e0adef119b01d1726f2adf442f6d47c6caf48c30 /Doc/library | |
parent | a12690ef49e8fc8a3af4c5f1757eb3caffb35e03 (diff) | |
download | cpython-29b5323c4567dc7772e1d30a7ba1cbad52fe10a9.zip cpython-29b5323c4567dc7772e1d30a7ba1cbad52fe10a9.tar.gz cpython-29b5323c4567dc7772e1d30a7ba1cbad52fe10a9.tar.bz2 |
gh-126175: Add attributes to TOMLDecodeError. Deprecate free-form `__init__` args (GH-126428)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/tomllib.rst | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/Doc/library/tomllib.rst b/Doc/library/tomllib.rst index 521a7a1..4b88b2e 100644 --- a/Doc/library/tomllib.rst +++ b/Doc/library/tomllib.rst @@ -60,9 +60,36 @@ This module defines the following functions: The following exceptions are available: -.. exception:: TOMLDecodeError +.. exception:: TOMLDecodeError(msg, doc, pos) - Subclass of :exc:`ValueError`. + Subclass of :exc:`ValueError` with the following additional attributes: + + .. attribute:: msg + + The unformatted error message. + + .. attribute:: doc + + The TOML document being parsed. + + .. attribute:: pos + + The index of *doc* where parsing failed. + + .. attribute:: lineno + + The line corresponding to *pos*. + + .. attribute:: colno + + The column corresponding to *pos*. + + .. versionchanged:: next + Added the *msg*, *doc* and *pos* parameters. + Added the :attr:`msg`, :attr:`doc`, :attr:`pos`, :attr:`lineno` and :attr:`colno` attributes. + + .. deprecated:: next + Passing free-form positional arguments is deprecated. Examples |