Skip to content

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

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.

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on Sep 7, 2022
  2. added 2 commits that reference this issue on Sep 7, 2022
  3. added a commit that references this issue on Sep 7, 2022
  4. added 4 commits that reference this issue on Sep 7, 2022
  5. corona10 commented on Sep 7, 2022

    @corona10
    Member

    I double-checked with the old python version

    
    Python 3.8.13 (default, Sep  7 2022, 20:07:00)
    [Clang 13.1.6 (clang-1316.0.21.2)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _functools
    >>> dir(_functools)
    ['__doc__', '__loader__', '__name__', '__package__', '__spec__', '_lru_cache_wrapper', 'cmp_to_key', 'partial', 'reduce']
    >>>
    

    Now we can close the issue

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

    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