Skip to content

upgrade positional only backwards compatability syntax in py38+ #518

@graingert

Description

@graingert

input

def run_non_trapping_async_fn(*async_fn_args, **kwargs):
    async_fn, *args = async_fn_args
    with contextlib.closing(async_fn(*args, **kwargs).__await__()) as gen:
        try:
            gen.send(None)
            raise AssertionError(f"{async_fn} did not stop")
        except StopIteration as e:
            return e.value

expected output:

def run_non_trapping_async_fn(async_fn, /, *args, **kwargs):
    with contextlib.closing(async_fn(*args, **kwargs).__await__()) as gen:
        try:
            gen.send(None)
            raise AssertionError(f"{async_fn} did not stop")
        except StopIteration as e:
            return e.value

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