New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recursive_repr forgets to override __qualname__ of wrapper #70821
Comments
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. |
FWIW, qualname was invented *after* recursive_repr, so it would be more accurate to say that qualname forgot recursive_repr :-) If you don't mind, please add a test to your patch. |
Hi, Raymond, I've added the test to test the assigned attributes. |
LGTM. I would commit the patch to 3.5 too. |
New changeset 1f0369547b0e by Serhiy Storchaka in branch '3.5': New changeset fb70ea8b7b2d by Serhiy Storchaka in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: