mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
[3.14] gh-139640: Fix swallowing syntax warnings in different modules (GH-139755) (GH-140117)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Revert GH-131993.
Fix swallowing some syntax warnings in different modules if they accidentally
have the same message and are emitted from the same line.
Fix duplicated warnings in the "finally" block.
(cherry picked from commit 279db6bede)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Update 2025-10-06-10-03-37.gh-issue-139640.gY5oTb.rst
---------
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
99e42ab49c
commit
af28efd8b4
7 changed files with 63 additions and 74 deletions
|
|
@ -103,6 +103,7 @@ typedef struct _PyCompiler {
|
|||
bool c_save_nested_seqs; /* if true, construct recursive instruction sequences
|
||||
* (including instructions for nested code objects)
|
||||
*/
|
||||
int c_disable_warning;
|
||||
} compiler;
|
||||
|
||||
static int
|
||||
|
|
@ -765,6 +766,9 @@ _PyCompile_PushFBlock(compiler *c, location loc,
|
|||
f->fb_loc = loc;
|
||||
f->fb_exit = exit;
|
||||
f->fb_datum = datum;
|
||||
if (t == COMPILE_FBLOCK_FINALLY_END) {
|
||||
c->c_disable_warning++;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -776,6 +780,9 @@ _PyCompile_PopFBlock(compiler *c, fblocktype t, jump_target_label block_label)
|
|||
u->u_nfblocks--;
|
||||
assert(u->u_fblock[u->u_nfblocks].fb_type == t);
|
||||
assert(SAME_JUMP_TARGET_LABEL(u->u_fblock[u->u_nfblocks].fb_block, block_label));
|
||||
if (t == COMPILE_FBLOCK_FINALLY_END) {
|
||||
c->c_disable_warning--;
|
||||
}
|
||||
}
|
||||
|
||||
fblockinfo *
|
||||
|
|
@ -1203,6 +1210,9 @@ _PyCompile_Error(compiler *c, location loc, const char *format, ...)
|
|||
int
|
||||
_PyCompile_Warn(compiler *c, location loc, const char *format, ...)
|
||||
{
|
||||
if (c->c_disable_warning) {
|
||||
return 0;
|
||||
}
|
||||
va_list vargs;
|
||||
va_start(vargs, format);
|
||||
PyObject *msg = PyUnicode_FromFormatV(format, vargs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue