Skip to content

Named tuples in import cycles still fail sometimes #4442

Closed
@ilevkivskyi

Description

@ilevkivskyi

It looks like issue #3054 was not completely fixed. Namely, in some scenarios named tuples
in import cycles result in Invalid type. For example, checking this file

import posix

results in

typeshed/stdlib/3/os/__init__.pyi:331: error: Invalid type "posix.uname_result"
typeshed/stdlib/3/os/__init__.pyi:599: error: Invalid type "posix.times_result"
typeshed/stdlib/3/os/__init__.pyi:605: error: Invalid type "posix.waitid_result"
typeshed/stdlib/3/os/__init__.pyi:622: error: Invalid type "posix.sched_param"
typeshed/stdlib/3/os/__init__.pyi:624: error: Invalid type "posix.sched_param"
typeshed/stdlib/3/os/__init__.pyi:625: error: Invalid type "posix.sched_param"

Note that the above "invalid" types are all named tuples and there is an import cycle os <-> posix. Interestingly, import os and from os import * both typecheck cleanly.

I haven't yet tried to find a simple repro (not involving typeshed).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions