-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix async_call.asyncio() and ConstFuture #135
Conversation
There was a bug where async_call.asyncio() returned futures.ConstFuture.
|
||
""" | ||
if is_pure_async_fn(fn): | ||
return await fn.asyncio(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is correct?
>>> @asynq.asynq(pure=True)
... def f():
... pass
...
>>> asynq.is_pure_async_fn(f)
True
>>> f.asyncio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'PureAsyncDecoratorPythonWrapper' object has no attribute 'asyncio'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 3.11.6 (main, Nov 14 2023, 09:36:21) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import asynq
>>> @asynq.asynq(pure=True)
... def f():
... pass
...
>>> asynq.is_pure_async_fn(f)
True
>>>
>>> f.asyncio
<bound method PureAsyncDecorator.asyncio of @asynq(pure=True) __main__.f>
>>>
>>>
print(type(f))
<class 'qcore.decorators.decorate.<locals>.PythonWrapper'>
print(f.asyncio)
<bound method PureAsyncDecorator.asyncio of @asynq(pure=True) __main__.f>
qcore==1.10.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe try rm -rf __pycache__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I may have had an old qcore or something.
d = yield async_call.asynq(f, *args, **kwargs) | ||
return d | ||
|
||
for f in [f1, f2, f3]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f2
(pure=True
) should cover your case
There was a bug where
async_call.asyncio()
returnedfutures.ConstFuture
.