summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-04-02 22:26:17 (GMT)
committerGitHub <noreply@github.com>2021-04-02 22:26:17 (GMT)
commit06653f8d15a8a84ee0f43f739704a9a63c27de54 (patch)
treed639bdc1b77d67cae3ded5f05bbab6b9d00b336f
parenta44771f9212381b90c539882448258c4300b2fe5 (diff)
downloadcpython-06653f8d15a8a84ee0f43f739704a9a63c27de54.zip
cpython-06653f8d15a8a84ee0f43f739704a9a63c27de54.tar.gz
cpython-06653f8d15a8a84ee0f43f739704a9a63c27de54.tar.bz2
bpo-43705: Document that SyntaxError's offsets are 1-indexed (GH-25153)
Changed the inline mentions of the attributes into a proper attribute list like `SystemExit` has. Automerge-Triggered-By: GH:gvanrossum (cherry picked from commit b2a91e0c9ee18b50cc86b21211c2258520a9f5d0) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
-rw-r--r--Doc/library/exceptions.rst22
1 files changed, 19 insertions, 3 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index 52a505e..519862c 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -397,9 +397,25 @@ The following exceptions are the exceptions that are usually raised.
or :func:`eval`, or when reading the initial script or standard input
(also interactively).
- Instances of this class have attributes :attr:`filename`, :attr:`lineno`,
- :attr:`offset` and :attr:`text` for easier access to the details. :func:`str`
- of the exception instance returns only the message.
+ The :func:`str` of the exception instance returns only the error message.
+
+ .. attribute:: filename
+
+ The name of the file the syntax error occurred in.
+
+ .. attribute:: lineno
+
+ Which line number in the file the error occurred in. This is
+ 1-indexed: the first line in the file has a ``lineno`` of 1.
+
+ .. attribute:: offset
+
+ The column in the line where the error occurred. This is
+ 1-indexed: the first character in the line has an ``offset`` of 1.
+
+ .. attribute:: text
+
+ The source code text involved in the error.
.. exception:: IndentationError