Skip to content

_functools.KeyWrapper is exposed after convertion to a new module type #96641

Closed
@sobolevn

Description

@sobolevn

After #23405 we now have KeyWrapper exposed.
I suspect that it is an internal helper and should not be importable:

Python 3.12.0a0 (heads/main:0d04b8d9e1, Sep  7 2022, 13:20:36) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from _functools import KeyWrapper
>>> help(KeyWrapper)
Help on class KeyWrapper in module functools:

class KeyWrapper(builtins.object)
 |  Methods defined here:
 |
 |  __call__(self, /, *args, **kwargs)
 |      Call self as a function.
 |
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  __ge__(self, value, /)
 |      Return self>=value.
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __gt__(self, value, /)
 |      Return self>value.
 |
 |  __le__(self, value, /)
 |      Return self<=value.
 |
 |  __lt__(self, value, /)
 |      Return self<value.

Related #26416
Found while working on #96640
CC @shihai1991

I will send a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions