Skip to content
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

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

dkang-quora
Copy link
Contributor

There was a bug where async_call.asyncio() returned futures.ConstFuture.

There was a bug where async_call.asyncio() returned futures.ConstFuture.

"""
if is_pure_async_fn(fn):
return await fn.asyncio(*args, **kwargs)
Copy link
Collaborator

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'

Copy link
Contributor Author

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

Copy link
Contributor Author

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__?

Copy link
Collaborator

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]:
Copy link
Contributor Author

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

@JelleZijlstra JelleZijlstra merged commit ebbc65f into quora:master Dec 5, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants