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

async/await checks are too aggressive and even escape type: ignore #2959

Closed
timabbott opened this issue Mar 4, 2017 · 5 comments
Closed

Comments

@timabbott
Copy link

timabbott commented Mar 4, 2017

I happen to use a third-party library (Mandrill) that has various functions that take the async keyword:

https://mandrillapp.com/api/docs/index.python.html

The error is this, and it applies even if you add a type: ignore on the affected line:
/tmp/foo.py:1: error: 'async' and 'await' will become reserved keywords in Python 3.7

def foo(async=True):                                                                                 
    pass                                                                                             
                                                                                                     
foo(async=False)  # type: ignore                                                                     

You get the same thing with even this:

x = dict(async=False)  # type: ignore                                                                

Other keywords don't have this problem (x = dict(type=False) works fine), so I think this is just a bug with this new friendly check for new keywords.

I worked around this by passing **{'async': False} instead, but it's kinda absurd.

@JelleZijlstra
Copy link
Member

I ran into this too. It might be an issue with typed-ast instead but I haven't looked into details yet.

@gvanrossum
Copy link
Member

There are two meanings of the term "keyword". Here, async and await will become reserved words of the language. type is just a "keyword argument". This really means that Mandrill will have to change.

Yet until then I agree that it would be nice if we could suppress the warning somehow. That may require a typed-ast change. @ddfisher?

@ddfisher
Copy link
Collaborator

ddfisher commented Mar 6, 2017

Oops, this is definitely a bug in typed-ast. I accidentally turned a conditional warning into an unconditional error when making some fixes for Python 3.3 compatibility. I don't think it's typed-ast's place to warn about this error, so I'm going to remove it instead.

@ddfisher
Copy link
Collaborator

ddfisher commented Mar 6, 2017

I'll release 1.0.2 to PyPI as soon as the wheels finish building.

@ddfisher
Copy link
Collaborator

ddfisher commented Mar 6, 2017

Released typed-ast 1.0.2.

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

4 participants