From 19176bdcce78db13114faa5beb4cf33d060d8e6a Mon Sep 17 00:00:00 2001 From: Hang Date: Fri, 29 Aug 2025 21:29:59 +0800 Subject: [PATCH] gh-123858: Improve Doc: SyntaxWarning is emitted during bytecode generation (gh-122844) --------- (cherry picked from commit 5f7906715adea645d8141d5337851872cfca4381) Co-authored-by: Hang Co-authored-by: Alyssa Coghlan --- Doc/library/exceptions.rst | 3 +++ Doc/library/warnings.rst | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 8cc887b8ceb378..9d3e0a4c20f9eb 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -890,6 +890,9 @@ The following exceptions are used as warning categories; see the Base class for warnings about dubious syntax. + This warning is typically emitted when compiling Python source code, and usually won't be reported + when running already compiled code. + .. exception:: RuntimeWarning diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst index 00bafd1be4bd0c..a2bb4b1830dec4 100644 --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -80,7 +80,9 @@ The following warnings category classes are currently defined: | | unless triggered by code in ``__main__``). | +----------------------------------+-----------------------------------------------+ | :exc:`SyntaxWarning` | Base category for warnings about dubious | -| | syntactic features. | +| | syntactic features (typically emitted when | +| | compiling Python source code, and hence | +| | may not be suppressed by runtime filters) | +----------------------------------+-----------------------------------------------+ | :exc:`RuntimeWarning` | Base category for warnings about dubious | | | runtime features. |