mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-17 17:10:53 +00:00
[syntax-errors] except*
before Python 3.11 (#16446)
Summary -- One of the simpler ones, just detect the use of `except*` before 3.11. Test Plan -- New inline tests.
This commit is contained in:
parent
0d615b8765
commit
e924ecbdac
9 changed files with 180 additions and 23 deletions
|
@ -439,13 +439,15 @@ impl<'src> Parser<'src> {
|
|||
}
|
||||
|
||||
/// Add an [`UnsupportedSyntaxError`] with the given [`UnsupportedSyntaxErrorKind`] and
|
||||
/// [`TextRange`].
|
||||
/// [`TextRange`] if its minimum version is less than [`Parser::target_version`].
|
||||
fn add_unsupported_syntax_error(&mut self, kind: UnsupportedSyntaxErrorKind, range: TextRange) {
|
||||
self.unsupported_syntax_errors.push(UnsupportedSyntaxError {
|
||||
kind,
|
||||
range,
|
||||
target_version: self.options.target_version,
|
||||
});
|
||||
if self.options.target_version < kind.minimum_version() {
|
||||
self.unsupported_syntax_errors.push(UnsupportedSyntaxError {
|
||||
kind,
|
||||
range,
|
||||
target_version: self.options.target_version,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if the current token is of the given kind.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue