Skip to content

pkg_resources.get_resource_stream should use io.open instead open on python 2 #1931

@Dobatymo

Description

@Dobatymo

DefaultProvider.get_resource_stream in pkg_resources should use io.open instead of open on Python 2 for multiple reasons:

  • better compatibility with python 3 code. On Python 3 open == io.open
  • better compatibility between the providers. The NullProvider uses io.BytesIO which has the same interface as io.open
  • allows using wrappers like TextIOWrapper which can then be used to convert the binary stream to a text stream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions