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

SyntaxError when creating a native coroutine function with name containing 'return' #96

Closed
smarie opened this issue Nov 9, 2023 · 0 comments · Fixed by #97
Closed

Comments

@smarie
Copy link
Owner

smarie commented Nov 9, 2023

from makefun import create_function

async def my_native_coroutine_handler(sleep_time):
    await sleep(sleep_time)
    return sleep_time

create_function("foo_returns_bar(sleep_time=2)", my_native_coroutine_handler)

raises

        filename = '<makefun-gen-%d>' % (next(_compile_count),)
        try:
>           code = compile(body, filename, 'single')
E             File "<makefun-gen-11>", line 1
E               async def foo_return awaits_bar(sleep_time=2):
E                                    ^
E           SyntaxError: invalid syntax

..\src\makefun\main.py:714: SyntaxError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant