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

upgrade positional only backwards compatability syntax in py38+ #518

Open
graingert opened this issue Aug 15, 2021 · 1 comment
Open

upgrade positional only backwards compatability syntax in py38+ #518

graingert opened this issue Aug 15, 2021 · 1 comment

Comments

@graingert
Copy link
Contributor

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
@asottile
Copy link
Owner

is this pattern common? it's going to be really difficult and error prone to get this correct

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

2 participants