Skip to content

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

Closed

Description

@smarie
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

Activity

  1. added a commit that references this issue on Nov 9, 2023
    221064d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions