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

Can't pass in a deferred to session.run under Python 3 #12

Open
mjpieters opened this issue Sep 6, 2019 · 0 comments
Open

Can't pass in a deferred to session.run under Python 3 #12

mjpieters opened this issue Sep 6, 2019 · 0 comments

Comments

@mjpieters
Copy link

The session.run() function has no path for a non-coroutine function being passed in, it'll simply return without calling twisted.react():

def run(self, f):
# Python 3 only.
if hasattr(inspect, 'iscoroutinefunction'):
# Is this a coroutine?
if inspect.iscoroutinefunction(f):
def w(reactor):
return self.wrap(f())
# If so, convert coroutine to Deferred automatically.
return task.react(w)
else:
# Otherwise, run the Deferred.
return task.react(f)

Under Python 3, line 63 is True, but if line 65 is False (so f is not a coroutine function) , the function ends. Should the else on line 70 be dropped, and lines 71 and 72 unindented?

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

No branches or pull requests

1 participant