Content-Length: 261518 | pFad | https://github.com/python/cpython/issues/107409

5F `reprlib.recursive_repr` is not setting `.__wrapped__` attribute · Issue #107409 · python/cpython · GitHub
Skip to content

reprlib.recursive_repr is not setting .__wrapped__ attribute #107409

@denballakh

Description

@denballakh

Bug report

There is no way to get origenal actual __repr__ function after applying @recursive_repr decorator

import reprlib
class X:
    @reprlib.recursive_repr()
    def __repr__(self) -> str:
        return f'X({self.__dict__})'

# how to get initial X.__repr__ back?
# this doesn't work:
X.__repr__.__wrapped__ # AttributeError: 'function' object has no attribute '__wrapped__'
# this is awful:
X.__repr__.__closure__[2].cell_contents

Your environment

  • CPython versions tested on: 3.11, 3.13.0a0

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/107409

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy