Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-96127: Fix inspect.signature call on mocks#96335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
sobolevn commented Aug 27, 2022 • edited by AlexWaygood
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by AlexWaygood
Uh oh!
There was an error while loading. Please reload this page.
sobolevn commented Aug 27, 2022
Re-triggering CI. |
graingert commented Sep 12, 2022
I have a similar PR somewhere about this, but I'm on mobile so it's tricky to find |
graingert commented Sep 12, 2022
#94962 is this related? |
sobolevn commented Sep 12, 2022 • edited by AlexWaygood
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by AlexWaygood
Uh oh!
There was an error while loading. Please reload this page.
They are not related as far as I can tell :) Your PR does not fix this exact problem: gh pr checkout 94962Python 3.12.0a0 (heads/main-dirty:a36235d5c7, Sep 11 2022, 12:23:24) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> from unittest.mock import AsyncMock >>> inspect.signature(AsyncMock()) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/sobolev/Desktop/cpython/Lib/inspect.py", line 3272, in signature return Signature.from_callable(obj, follow_wrapped=follow_wrapped, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sobolev/Desktop/cpython/Lib/inspect.py", line 3020, in from_callable return _signature_from_callable(obj, sigcls=cls, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sobolev/Desktop/cpython/Lib/inspect.py", line 2507, in _signature_from_callable return _signature_from_function(sigcls, obj, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/sobolev/Desktop/cpython/Lib/inspect.py", line 2351, in _signature_from_function positional = arg_names[:pos_count] ~~~~~~~~~^^^^^^^^^^^^ TypeError: 'Mock' object is not subscriptable |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cjw296 commented Jan 7, 2023
@sobolevn - could you rebase and resolve the conflicts? I think this is then good to land after another quick eyeball from a reviewer... |
sobolevn commented Jan 7, 2023
Sure!
I hope we can land this now! |
zmievsa commented Feb 1, 2023
@sobolevn this fix saved me big time. Thank you for your amazing work! |
miss-islington commented Feb 7, 2023
miss-islington commented Feb 7, 2023
Sorry @sobolevn and @cjw296, I had trouble checking out the |
miss-islington commented Feb 7, 2023
miss-islington commented Feb 7, 2023
Sorry, @sobolevn and @cjw296, I could not cleanly backport this to |
(cherry picked from commit 9e7d726)
(cherry picked from commit 9e7d726)
bedevere-bot commented Feb 7, 2023
GH-101646 is a backport of this pull request to the 3.11 branch. |
bedevere-bot commented Feb 7, 2023
GH-101647 is a backport of this pull request to the 3.10 branch. |
) (cherry picked from commit 9e7d726) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Before:
After:
Related #94050