Skip to content

Conversation

@vxgmichel
Copy link
Contributor

@vxgmichel vxgmichel commented May 23, 2020

I noticed that the PythonRepl.run_async() method is not equivalent to PythonRepl.run(), even though it should behave the same according to the code in ptpython.repl.embed:

ptpython/ptpython/repl.py

Lines 369 to 378 in 89017ba

if return_asyncio_coroutine:
async def coroutine():
with patch_context:
await repl.run_async()
return coroutine()
else:
with patch_context:
repl.run()

This is part of my work on prompt-toolkit/python-prompt-toolkit#1150

Note: f1c4906 is entirely optional

@jonathanslenders jonathanslenders merged commit f1ad662 into prompt-toolkit:master Jul 10, 2020
@jonathanslenders
Copy link
Member

Thank you!

@davidmoss
Copy link

davidmoss commented Jul 14, 2020

This change causes django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async. when used with shell_plus. I know this can be suppressed with DJANGO_ALLOW_ASYNC_UNSAFE=True but the question is was this expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants