[issue26634] recursive_repr forgets to override __qualname__ of wrapper

Xiang Zhang report at bugs.python.org
Thu Mar 24 00:09:36 EDT 2016


New submission from Xiang Zhang:

In reprlib.recursive_repr, it seems __qualname__ is forgotten. Giving the example in reprlib document, it gives a strange result 'recursive_repr.<locals>.decorating_function.<locals>.wrapper' of Mylist.__repr__.__qualname__.

I simply add the assignment of __qualname__. But I doubt the treatment of __module__, __doc__, __name__, __qualname__ will raise AttributeError when they don't exist in user_function. Is this the desired behaviour or we'd better treat them like functools.update_wrapper, catch and then ignore the error.

----------
components: Library (Lib)
files: qualname_of_recursive_repr_in_reprlib.patch
keywords: patch
messages: 262326
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: recursive_repr forgets to override __qualname__ of wrapper
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file42266/qualname_of_recursive_repr_in_reprlib.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26634>
_______________________________________


More information about the Python-bugs-list mailing list