Skip to content

Commit fc41707

Browse files
committed
Fix StringIO initialization, fixes #408
1 parent 03ed4f8 commit fc41707

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

crates/zuban_python/src/file/type_computation/class.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,7 @@ impl<'db: 'a, 'a> ClassInitializer<'a> {
16511651
.any(|&l| NodeRef::from_link(db, l).as_code() == name)
16521652
{
16531653
for (i, base) in mro.iter().enumerate() {
1654-
if base.is_direct_base
1655-
&& mro_index != i
1654+
if mro_index != i
16561655
&& let Type::Class(c) = &base.type_
16571656
{
16581657
let class = c.class(db);

crates/zuban_python/tests/mypylike/tests/classes.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2795,3 +2795,9 @@ class Movie(TypedDict):
27952795
@disjoint_base # E: @disjoint_base cannot be used with protocol class
27962796
class SupportsClose(Protocol):
27972797
def close(self) -> None: ...
2798+
2799+
[case string_io_initialization]
2800+
# From GH #408
2801+
from io import StringIO
2802+
2803+
StringIO()

0 commit comments

Comments
 (0)