From 6ef0700a1194d23953c3355ed5729c896aac5aa9 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Sun, 28 May 2023 22:57:22 +0200 Subject: [PATCH 1/3] gh-89412: Add missing 3.10 attributes to traceback module docs --- Doc/library/traceback.rst | 14 ++++++++++++++ Lib/traceback.py | 4 ++-- .../2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 5c0e261b90763c..3db6d1a4622371 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -266,6 +266,13 @@ capture data for later printing in a lightweight fashion. For syntax errors - the line number where the error occurred. + .. attribute:: end_lineno + + For syntax errors - the end line number where the error occurred. + Can be ``None`` if not present. + + .. versionadded:: 3.10 + .. attribute:: text For syntax errors - the text where the error occurred. @@ -274,6 +281,13 @@ capture data for later printing in a lightweight fashion. For syntax errors - the offset into the text where the error occurred. + .. attribute:: end_offset + + For syntax errors - the end offset into the text where the error occurred. + Can be ``None`` if not present. + + .. versionadded:: 3.10 + .. attribute:: msg For syntax errors - the compiler error message. diff --git a/Lib/traceback.py b/Lib/traceback.py index 419f6e81b5e1be..be3cb463318929 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -672,8 +672,8 @@ class TracebackException: occurred. - :attr:`offset` For syntax errors - the offset into the text where the error occurred. - - :attr:`end_offset` For syntax errors - the offset into the text where the - error occurred. Can be `None` if not present. + - :attr:`end_offset` For syntax errors - the end offset into the text where + the error occurred. Can be `None` if not present. - :attr:`msg` For syntax errors - the compiler error message. """ diff --git a/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst b/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst new file mode 100644 index 00000000000000..edd2e63a64d251 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst @@ -0,0 +1 @@ +Add missing documentation for the ``end_lineno``, and ``end_offset`` attributes of the :class:`traceback.TracebackException` class From 00a3eaaac394d8cc995f373dd7540f4542b15cd5 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Sun, 28 May 2023 23:08:47 +0200 Subject: [PATCH 2/3] Remove oxford comma --- .../Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst b/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst index edd2e63a64d251..56a765e207abb8 100644 --- a/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst +++ b/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst @@ -1 +1 @@ -Add missing documentation for the ``end_lineno``, and ``end_offset`` attributes of the :class:`traceback.TracebackException` class +Add missing documentation for the ``end_lineno`` and ``end_offset`` attributes of the :class:`traceback.TracebackException` class From 9ce5cc84311289b423cd6227f9d8828df3de98ea Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Mon, 29 May 2023 20:34:42 +0200 Subject: [PATCH 3/3] Wrap at 80 chars and add a full stop --- .../2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst b/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst index 56a765e207abb8..00937e58c98595 100644 --- a/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst +++ b/Misc/NEWS.d/next/Documentation/2023-05-28-19-08-42.gh-issue-89412.j4cg7K.rst @@ -1 +1,2 @@ -Add missing documentation for the ``end_lineno`` and ``end_offset`` attributes of the :class:`traceback.TracebackException` class +Add missing documentation for the ``end_lineno`` and ``end_offset`` attributes +of the :class:`traceback.TracebackException` class.