Fix ExceptionGroup F821 false positive (#3167)

This commit is contained in:
Jonathan Plasse 2023-02-23 13:36:11 +01:00 committed by GitHub
parent 77d43795f8
commit ad7ba77fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,4 @@
try:
pass
except ExceptionGroup:
pass

View File

@ -102,6 +102,7 @@ mod tests {
#[test_case(Rule::UndefinedName, Path::new("F821_7.py"); "F821_7")]
#[test_case(Rule::UndefinedName, Path::new("F821_8.pyi"); "F821_8")]
#[test_case(Rule::UndefinedName, Path::new("F821_9.py"); "F821_9")]
#[test_case(Rule::UndefinedName, Path::new("F821_10.py"); "F821_10")]
#[test_case(Rule::UndefinedExport, Path::new("F822_0.py"); "F822_0")]
#[test_case(Rule::UndefinedExport, Path::new("F822_1.py"); "F822_1")]
#[test_case(Rule::UndefinedExport, Path::new("F822_2.py"); "F822_2")]

View File

@ -0,0 +1,6 @@
---
source: crates/ruff/src/rules/pyflakes/mod.rs
expression: diagnostics
---
[]

View File

@ -3,6 +3,7 @@ pub const BUILTINS: &[&str] = &[
"AssertionError",
"AttributeError",
"BaseException",
"BaseExceptionGroup",
"BlockingIOError",
"BrokenPipeError",
"BufferError",
@ -15,8 +16,10 @@ pub const BUILTINS: &[&str] = &[
"DeprecationWarning",
"EOFError",
"Ellipsis",
"EncodingWarning",
"EnvironmentError",
"Exception",
"ExceptionGroup",
"False",
"FileExistsError",
"FileNotFoundError",