Skip to content

Use Protocol for pickle.load #5477

@JelleZijlstra

Description

@JelleZijlstra

The file argument to pickle.load is annotated as IO[bytes], but should be annotated using a Protocol instead. The stub is at https://github.com/python/typeshed/blob/master/stdlib/pickle.pyi#L28.

This caused concrete problems for two people on Gitter who were trying to pass a GzipFile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: ioI/O related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions