[issue46761] functools.update_wrapper breaks the signature of functools.partial objects
Graham Dumpleton
report at bugs.python.org
Fri Mar 25 19:18:35 EDT 2022
Graham Dumpleton <Graham.Dumpleton at gmail.com> added the comment:
It is Django I would worry about and look at closely as they do stuff with decorators on instance methods that uses partials.
https://github.com/django/django/blob/7119f40c9881666b6f9b5cf7df09ee1d21cc8344/django/utils/decorators.py#L43
```
def _wrapper(self, *args, **kwargs):
# bound_method has the signature that 'decorator' expects i.e. no
# 'self' argument, but it's a closure over self so it can call
# 'func'. Also, wrap method.__get__() in a function because new
# attributes can't be set on bound method objects, only on functions.
bound_method = wraps(method)(partial(method.__get__(self, type(self))))
for dec in decorators:
bound_method = dec(bound_method)
return bound_method(*args, **kwargs)
```
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46761>
_______________________________________
More information about the Python-bugs-list
mailing list