Skip to content

Commit

Permalink
Decrease PEP 593 error to a debug warning (#7745)
Browse files Browse the repository at this point in the history
## Summary

There's no way for users to fix this warning if they're intentionally
using an "invalid" PEP 593 annotation, as is the case in CPython. This
is a symptom of having warnings that aren't themselves diagnostics. If
we want this to be user-facing, we should add a diagnostic for it!

## Test Plan

Ran `cargo run -p ruff_cli -- check foo.py -n` on:

```python
from typing import Annotated

Annotated[int]
```
  • Loading branch information
charliermarsh authored Oct 1, 2023
1 parent d8a6279 commit 4d2de89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/ruff_linter/src/checkers/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use std::path::Path;

use itertools::Itertools;
use log::error;
use log::debug;
use ruff_python_ast::{
self as ast, Arguments, Comprehension, Constant, ElifElseClause, ExceptHandler, Expr,
ExprContext, Keyword, MatchCase, Parameter, ParameterWithDefault, Parameters, Pattern, Stmt,
Expand Down Expand Up @@ -1176,7 +1176,7 @@ where
self.visit_expr_context(ctx);
}
} else {
error!("Found non-Expr::Tuple argument to PEP 593 Annotation.");
debug!("Found non-Expr::Tuple argument to PEP 593 Annotation.");
}
}
None => {
Expand Down

0 comments on commit 4d2de89

Please sign in to comment.