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
E
======================================================================
ERROR: test_mk (test.TestIsinstance.test_mk)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/reprod/test.py", line 10, in test_mk
inspect.signature(foo)
~~~~~~~~~~~~~~~~~^^^^^
File "/Users/clm/.pyenv/versions/3.13.0b3/lib/python3.13/inspect.py", line 3333, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
globals=globals, locals=locals, eval_str=eval_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/clm/.pyenv/versions/3.13.0b3/lib/python3.13/inspect.py", line 3059, in from_callable
return _signature_from_callable(obj, sigcls=cls,
follow_wrapper_chains=follow_wrapped,
globals=globals, locals=locals, eval_str=eval_str)
File "/Users/clm/.pyenv/versions/3.13.0b3/lib/python3.13/inspect.py", line 2559, in _signature_from_callable
if isinstance(obj, functools.partial):
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union
----------------------------------------------------------------------
Ran 1 test in 0.002s
FAILED (errors=1)
Thanks for pointing this out !
I was able to resolve this on our side by avoiding mocking altogether at astropy/astropy#16659
Feel free to close this issue.
Activity
[-]3.13.0b3 regression: [/-][+]3.13.0b3 regression: inspect.signature + unittest.mock[/+]picnixz commentedon Jul 2, 2024
Could it be because of #121092? (especially: https://github.com/python/cpython/pull/121092/files#diff-b89cd06e4637abacb73f2500301ff979a67ad7ecbfa7cf151c7243715898d7eaL2570-L2573)
neutrinoceros commentedon Jul 2, 2024
Thank you ! It's definitely related: the test pass if I revert just the bit you pointed to.
picnixz commentedon Jul 2, 2024
cc @serhiy-storchaka
serhiy-storchaka commentedon Jul 2, 2024
It is not safe to patch
functools.partialwhich is used in theinspectmodule and then use theinspectmodule.Add the following code in your example and you will see that it was broken before #121092.
neutrinoceros commentedon Jul 2, 2024
Thanks for pointing this out !
I was able to resolve this on our side by avoiding mocking altogether at astropy/astropy#16659
Feel free to close this issue.