PEP 765: specify when the SyntaxWarning will be emitted, and explain why (#4132)

This commit is contained in:
Irit Katriel 2024-11-21 23:02:24 +00:00 committed by GitHub
parent ac1c66e538
commit aa1603b1e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -132,6 +132,16 @@ However, we specify here that a ``SyntaxError`` is permitted by
the language spec, so that other Python implementations can choose
to implement that.
The CPython implementation will emit the ``SyntaxWarning`` during
``AST`` construction, to ensure that the warning will show up during
static anlaysis and compilation, but not during execution of
pre-compiled code. We expect that the warning will be seen by a
project maintainer (when they run static analysis, or CI which
does not have precompiled files). However, end users of a project
will only see a warning if they skip precompilation at installation
time, check installation time warnings, or run static analysis over
their dependencies.
Backwards Compatibility
=======================