[issue35383] lib2to3 raises ParseError on argument called "print"

2019-01-13 Thread timokau
timokau added the comment: Also `print("a", file=sys.stderr)` *is* valid python2 provided that `print_function` is imported. -- ___ Python tracker ___ ___

[issue35383] lib2to3 raises ParseError on argument called "print"

2019-01-13 Thread timokau
timokau added the comment: I disagree that this is "not a bug". While conversion from 2 to 3 is 2to3's main intention, the documentation advertises: 2to3 supporting library lib2to3 is, however, a flexible and generic library, so it is possible to write your own fixers for 2to3. lib2to3 could

[issue35383] lib2to3 raises ParseError on argument called "print"

2018-12-07 Thread Martin Panter
Martin Panter added the comment: Previous related reports: * Issue 35260: “2to3” doesn’t parse Python 3’s “print” function by default because it is supposed to translate Python 2 syntax * Issue 2412: “2to3” should support “from __future__ import print_function”. That frees up the “print” rese

[issue35383] lib2to3 raises ParseError on argument called "print"

2018-12-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: In 2.x, 'print' is a reserved keyword and compiling foo fails with SyntaxError. AFAIK, 2to3 expects the input to be *valid* 2.x code that compiles. So it seems to me that the bug is in the input, not 2to3, and that this issue should be closed as 'not a bug

[issue35383] lib2to3 raises ParseError on argument called "print"

2018-12-03 Thread Niklas Rosenstein
New submission from Niklas Rosenstein : On Python 3.7.0 lib2to3 will not parse code like this: def foo(print=None): pass and yield the following error instead lib2to3.pgen2.parse.ParseError: bad input: type=1, value='print', context=('', (1, 8)) -- components: 2to3 (2.