mirror of
https://github.com/python/cpython.git
synced 2025-09-09 18:32:22 +00:00
[3.11] gh-111380: Show SyntaxWarnings only once when parsing if invalid syntax is encouintered (GH-111381) (#111383)
gh-111380: Show SyntaxWarnings only once when parsing if invalid syntax is encouintered (GH-111381)
(cherry picked from commit 3d2f1f0b83
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
c66f0bedeb
commit
08e4e11b75
3 changed files with 19 additions and 0 deletions
|
@ -11,6 +11,11 @@
|
|||
static int
|
||||
warn_invalid_escape_sequence(Parser *p, const char *first_invalid_escape, Token *t)
|
||||
{
|
||||
if (p->call_invalid_rules) {
|
||||
// Do not report warnings if we are in the second pass of the parser
|
||||
// to avoid showing the warning twice.
|
||||
return 0;
|
||||
}
|
||||
unsigned char c = *first_invalid_escape;
|
||||
int octal = ('4' <= c && c <= '7');
|
||||
PyObject *msg =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue