You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found just while playing around with red_knot ( b4d9d26 )
test.py
classFoo(object):
pass
works fine
Renaming it to test.pyi results in:
$ ./../target/debug/red_knot && echo $?
0
$ mv test.py test.pyi
$ ./../target/debug/red_knot && echo $?
thread '<unnamed>' panicked at crates/red_knot_python_semantic/src/types/infer.rs:177:25:
no entry found for key
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Rayon: detected unexpected panic; aborting
Aborted (core dumped)
Seems to crash with anything as the parent.
relevant part of RUST_BACKTRACE=full:
19: 0x561605928fe5 - core::option::Option<T>::expect::hffc771cc74f800e9
at /build/rustc-kAv1jW/rustc-1.75.0+dfsg0ubuntu1~bpo0/library/core/src/option.rs:894:21
20: 0x561605928fe5 - <std::collections::hash::map::HashMap<K,V,S> as core::ops::index::Index<&Q>>::index::hf84fbd63e8ba27dd
at /build/rustc-kAv1jW/rustc-1.75.0+dfsg0ubuntu1~bpo0/library/std/src/collections/hash/map.rs:1341:23
21: 0x56160595a8e4 - red_knot_python_semantic::types::infer::TypeInference::expression_ty::h45e30f4ed3623f78
at /home/cpigott/dev/ruff/crates/red_knot_python_semantic/src/types/infer.rs:177:25
22: 0x56160579d5e4 - <ruff_python_ast::expression::ExpressionRef as red_knot_python_semantic::semantic_model::HasTy>::ty::h7574fdc81220df66
at /home/cpigott/dev/ruff/crates/red_knot_python_semantic/src/semantic_model.rs:62:9
23: 0x5616056603b5 - <ruff_python_ast::nodes::ExprName as red_knot_python_semantic::semantic_model::HasTy>::ty::h0bf9800421b11df7
at /home/cpigott/dev/ruff/crates/red_knot_python_semantic/src/semantic_model.rs:72:17
24: 0x561605600139 - red_knot_workspace::lint::lint_maybe_undefined::hbf56527a89120b0f
at /home/cpigott/dev/ruff/crates/red_knot_workspace/src/lint.rs:117:11
25: 0x561605600d9e - <red_knot_workspace::lint::SemanticVisitor as ruff_python_ast::visitor::Visitor>::visit_expr::h4e5d2046d4543b66
at /home/cpigott/dev/ruff/crates/red_knot_workspace/src/lint.rs:244:17
26: 0x56160561fbfd - ruff_python_ast::visitor::walk_arguments::hcf8638d59de7f088
at /home/cpigott/dev/ruff/crates/ruff_python_ast/src/visitor.rs:597:9
27: 0x5616055f9674 - ruff_python_ast::visitor::Visitor::visit_arguments::he4e1af453a0b6b0f
at /home/cpigott/dev/ruff/crates/ruff_python_ast/src/visitor.rs:58:9
28: 0x5616056238bc - ruff_python_ast::visitor::walk_stmt::h8c2b40d349b01a24
at /home/cpigott/dev/ruff/crates/ruff_python_ast/src/visitor.rs:165:17
29: 0x561605600d2a - <red_knot_workspace::lint::SemanticVisitor as ruff_python_ast::visitor::Visitor>::visit_stmt::h2cea15d01c9fd284
at /home/cpigott/dev/ruff/crates/red_knot_workspace/src/lint.rs:238:9
30: 0x561605620f36 - ruff_python_ast::visitor::walk_body::hd1184b90f5a26118
at /home/cpigott/dev/ruff/crates/ruff_python_ast/src/visitor.rs:115:9
31: 0x5616055f93f8 - ruff_python_ast::visitor::Visitor::visit_body::h1b0a1fbe97acb4d0
at /home/cpigott/dev/ruff/crates/ruff_python_ast/src/visitor.rs:94:9
32: 0x561605602c32 - <red_knot_workspace::lint::lint_semantic::Configuration_ as salsa::function::Configuration>::execute::inner_::h18d04db1014d8c80
at /home/cpigott/dev/ruff/crates/red_knot_workspace/src/lint.rs:93:5
Looking forward to seeing where this goes!
The text was updated successfully, but these errors were encountered:
Test coverage for #13131 wasn't as good as I thought it was, because
although we infer a lot of types in stubs in typeshed, we don't check
typeshed, and therefore we don't do scope-level inference and pull all
types for a scope. So we didn't really have good test coverage for
scope-level inference in a stub. And because of this, I got the code for
supporting that wrong, meaning that if we did scope-level inference with
deferred types, we'd end up never populating the deferred types in the
scope's `TypeInference`, which causes panics like #13160.
Here I both add test coverage by running the corpus tests both as `.py`
and as `.pyi` (which reveals the panic), and I fix the code to support
deferred types in scope inference.
This also revealed a problem with deferred types in generic functions,
which effectively span two scopes. That problem will require a bit more
thought, and I don't want to block this PR on it, so for now I just
don't defer annotations on generic functions.
Fixes#13160.
Found just while playing around with
red_knot
( b4d9d26 )test.py
works fine
Renaming it to test.pyi results in:
Seems to crash with anything as the parent.
relevant part of
RUST_BACKTRACE=full
:Looking forward to seeing where this goes!
The text was updated successfully, but these errors were encountered: