mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Recover numeric warning errors in AST single mode (#9303)
Match ordinary single compilation by allowing later numeric warnings raised as errors to take precedence after a parser-origin escape warning. Preserve tokenizer-origin guards and the separate prompt path. Assisted-by: Codex:unknown
This commit is contained in:
1 parent
6c171fffe1
commit
36f8e8937a
1 file changed
+8
-1
@@ -1983,8 +1983,15 @@ mod escape_warnings {
|
||||
module.map(AsObject::as_object),
|
||||
collected.warnings,
|
||||
WarningEmission::Ast {
|
||||
// Unlike an interactive prompt, Single compile input recovers
|
||||
// after a parser warning becomes an error. Later numeric
|
||||
// tokenizer warnings raised as errors still take precedence,
|
||||
// including on a following logical line.
|
||||
tokenizer_recovery: collected.tokenizer_recovery
|
||||
&& matches!(start, CompileStart::File | CompileStart::Eval),
|
||||
&& matches!(
|
||||
start,
|
||||
CompileStart::File | CompileStart::Eval | CompileStart::Single
|
||||
),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user