Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Python setattr(Class, name, func) automatically converts a function into an instancemethod. To keep type(Class.func) as function, staticmethod(func) must be applied explicitly. This was previously fixed for Python 2 when cleaning up the patched function but Python 3 needs the same handling. When patching a function it was being converted to an instancemethod for both Python 2 and 3 and this has now been fixed. This is a breaking change as it was previously acceptable to patch a staticmethod with an instancemethod. The test for this case was updated to correctly check both cases. The patched function is called as both Class.function() and Class().function(), and then called again after the cleanup has occurred resetting the function to its original state. The Class().function() check is important because the method does not become bound until the class it is defined on is instantiated. Sem-Ver: api-break
- Loading branch information