in doubles/proxy_method.py [0:0]
def _restore__new__(target, original_method):
"""Restore __new__ to original_method on the target
Python 3 does some magic to verify no arguments are sent to __new__ if it
is the builtin version, to work in python 3 we must handle this:
1) If original_method is the builtin version of __new__, wrap the
builtin __new__ to ensure that no arguments are passed in.
2) If original_method is a custom method treat it the same as we would
in python2
:param class target: The class to restore __new__ on
:param func original_method: The method to set __new__ to
"""
if isbuiltin(original_method):
@wraps(original_method)
def _new(cls, *args, **kwargs):
return original_method(cls)
target.__new__ = _new
else:
target.__new__ = original_method