Repository navigation
bpo-30406: Make async and await proper keywords #1669
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
Changes from 1 commit
abbd401
8e16e6b
81dae40
9e65b47
f850135
f95c992
5c8bddc
ac04cff
8af009f
4289253
cf2f467
c824937
ca85605
505a66d
57fb8ed
e987d50
dacf3e6
d31627a
ef28dea
499aa40
7c664e3
5659c8d
2413e3e
cdbc7d5
38ba810
78ddbde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,34 +167,34 @@ def foo(): pass | |
| async def foo(): await x | ||
| """) | ||
|
|
||
| self.invalid_syntax("await x") | ||
| self.invalid_syntax("""def foo(): | ||
| await x""") | ||
| self.validate("await x") | ||
| self.validate("""def foo(): | ||
| await x""") | ||
|
|
||
| self.invalid_syntax("""def foo(): | ||
| self.validate("""def foo(): | ||
| def foo(): pass | ||
| async def foo(): pass | ||
| await x | ||
| """) | ||
|
|
||
| def test_async_var(self): | ||
| self.validate("""async = 1""") | ||
| self.validate("""await = 1""") | ||
| self.validate("""def async(): pass""") | ||
| self.invalid_syntax("""async = 1""") | ||
| self.invalid_syntax("""await = 1""") | ||
| self.invalid_syntax("""def async(): pass""") | ||
|
|
||
| def test_async_with(self): | ||
| self.validate("""async def foo(): | ||
| async for a in b: pass""") | ||
|
|
||
| self.invalid_syntax("""def foo(): | ||
| async for a in b: pass""") | ||
| self.validate("""def foo(): | ||
| async for a in b: pass""") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wait... this one looks like a bug.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think lib2to3's parser in general doesn't do semantic checking of the sort that would be required to reject this. For example, it also doesn't fail on putting |
||
|
|
||
| def test_async_for(self): | ||
| self.validate("""async def foo(): | ||
| async with a: pass""") | ||
|
|
||
| self.invalid_syntax("""def foo(): | ||
| async with a: pass""") | ||
| self.validate("""def foo(): | ||
| async with a: pass""") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto (also a bug)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, this is also lib2to3. |
||
|
|
||
|
|
||
| class TestRaiseChanges(GrammarTest): | ||
|
|
@@ -477,3 +477,7 @@ def diff(fn, result): | |
| os.remove("@") | ||
| except OSError: | ||
| pass | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding to the point raised for changes in
Grammar: when you change/rename/add new productions here, you might be breaking some code that useslib2to3to define custom fixters. Again, I'd avoid any changes.