-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
C Task objects cannot be mocked with multiple inhertance #111542
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
Comments
This seems to be solved on » ./python.exe --version
Python 3.13.0a1+
(.venv) ~/Desktop/cpython2 main ✗
» ./python.exe ex.py
/Users/sobolev/Desktop/cpython2/ex.py:19: DeprecationWarning: There is no current event loop
with mock.patch.object(MyPyTask(func()), "foo"):
|
Indeed. Using binary search I have found the commit: The issue is a different one, but it has fixed this issue as a side effect of re-structuring the types in the module. |
Unfortunately, we cannot backport these types of changes :( ISTM, there is nothing to do for 3.12 and older, so I suggest closing this issue. cc. @kumaraditya303 |
Yeah nothing can be done for older versions. If you really want to patch it then avoid using C implementation by sys.modules['_asyncio'] = None |
What I meant was that since the commit was almost a year ago, did it make it into the 3.12 branch before it got branched off master? I haven't been a regular core contributor for almost 10 years now and don't follow the development roadmap too closely. However, I do take it from your reply that it didn't. Cheers, and thanks for looking into this with me. |
I think that it made into 3.12, but not into 3.11 |
@kristjanvalur Main and 3.12.0 were separated in May. With our current yearly schedule, this is predictable. |
Bug report
Bug description:
When inheriting from
asyncio.Task
, which by default is a C implemented object, and also froma python class, mocking fails on the resulting object. Running the following code will result in an error, on python 3.11 and all other versions I've tested:
This results in:
CPython versions tested on:
3.10, 3.11
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: