Skip to content

Incorrect type annotation of tarfile.Tarfile.fileobj #15365

@emontnemery

Description

@emontnemery

tarfile.Tarfile.fileobj is incorrectly typed as _Fileobj | None, the correct type is _Fileobj

fileobj: _Fileobj | None

Looking back at the history, it seems this was introduced when tarfile was first added to typeshed in #467

For reference, tarfile.Tarfile.fileobj is unconditionally set to a _Fileobj in the tarfile.Tarfile constructor, and never set anywhere else: https://github.com/python/cpython/blob/93b27e7f6d185efd5163d04fcdae8436ebf69144/Lib/tarfile.py#L1743-L1758

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions