Remove `_ProxyFile.__class_getitem__` · Issue #140808 · python/cpython · GitHub
Skip to content

Remove _ProxyFile.__class_getitem__ #140808

Description

@srittau

Feature or enhancement

Proposal:

#19425 made the internal file wrapper mailbox._ProxyFile generic, probably because it was generic over AnyStr in typeshed. (Unchanged since mailbox.pyi was added in python/typeshed#3427. There was no discussion about it back then.)

_ProxyFile does not need to be generic, as it's only used internally by mailbox.py and is always initialized with a binary file object (as returned by open()). In fact, this now complicates the stubs for mailbox.pyi, because we need to carry the generic-ness of this class through to other protocols. See python/typeshed#14950 for details.

I suggest to remove __class_getitem__ again, although this probably needs to go through the deprecation process, even though this is an internal class?

Cc @emmatyping @JelleZijlstra @AlexWaygood

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions