From 70f29f8ff4e46dfdeddd1ca635c97e0634f83981 Mon Sep 17 00:00:00 2001 From: Aayaan Khan <186551075+Akay-74@users.noreply.github.com> Date: Thu, 26 Nov 2026 14:27:10 +0530 Subject: [PATCH] gh-162603: Clarify SyntaxError message and string representation --- Doc/builtins/exceptions.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/builtins/exceptions.rst b/Doc/builtins/exceptions.rst index 1bb52a02f48b2f4..c2e0eba37a120e0 100644 --- a/Doc/builtins/exceptions.rst +++ b/Doc/builtins/exceptions.rst @@ -535,8 +535,13 @@ The following exceptions are the exceptions that are usually raised. or :func:`eval`, or when reading the initial script or standard input (also interactively). - The :func:`str` of the exception instance returns only the error message. - Details is a tuple whose members are also available as separate attributes. + The :func:`str` of the exception instance returns the error message, + possibly with the filename, line number, or both. *details* is a tuple + whose members are also available as separate attributes. + + .. attribute:: msg + + The error message. .. attribute:: filename