You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a follow-up to bpo-33261, which added general support for detecting generator / coroutine / async generator functions wrapped in partials. It appears that partialmethod objects were missed out.
While a partialmethod object will produce a functools.partial() object on binding to an instance, the .func attribute of that partial is a bound method, not a function, and the current _has_code_flag implementation unwraps methods *before* it unwraps partials.
Next, binding to a class produces a partialmethod._make_unbound_method.._method wrapper function. _unwrap_partial can't unwrap this, as it doesn't handle this case; it could look for the _partialmethod attribute and follow that to find the .func attribute.
I've recently ran into this via unittest.mock.patch.object. Mocking an asynchronous partial method returns MagicMock and not AsyncMagicMock, causing some pretty hard to debug failures.
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: