[issue35260] 2to3 Parse Error on Python 3 print() with arguments

2018-11-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

Closing. 2to3 is working as designed here.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35260] 2to3 Parse Error on Python 3 print() with arguments

2018-11-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

I'm still confused: the main purpose of 2to3 is to take Python 2 code and turn 
it into Python 3 code. The docs[1] are fairly unambiguous here:

> 2to3 is a Python program that reads Python 2.x source code and applies a 
> series of fixers to transform it into valid Python 3.x code.

So expecting 2to3 *not* to parse code as though it's Python 2 code seem odd.

[1] https://docs.python.org/3.7/library/2to3.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35260] 2to3 Parse Error on Python 3 print() with arguments

2018-11-16 Thread batterystaple456


batterystaple456  added the comment:

I was expecting that like other Python 3 code, since it is already in Python 3, 
it would not parse it like Python 2.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35260] 2to3 Parse Error on Python 3 print() with arguments

2018-11-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

I'm not sure I understand the report: 2to3 expects a valid Python 2 file as 
input, and the file a.py isn't a valid Python 2 file: the `print` line is a 
SyntaxError in the absence of a `from __future__ import print_function`.

So yes, this *is* being treated like Python 2 code, but that's what 2to3 is 
designed to do.

Can you say what you expected to happen here?

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35260] 2to3 Parse Error on Python 3 print() with arguments

2018-11-15 Thread batterystaple456


Change by batterystaple456 :


--
type: compile error -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35260] 2to3 Parse Error on Python 3 print() with arguments

2018-11-15 Thread batterystaple456


New submission from batterystaple456 :

File a.py:


print("foo", end='bar') # ParseError


I think the error is caused by arguments in the Python 3 print() function (e.g. 
end, sep) that are not ignored by 2to3, and (possibly) treated like Python 2 
code.

Console stuff:

---
$ pip install 2to3
Requirement already satisfied: 2to3 in .\python37\lib\site-packages (1.0)

$ 2to3 .\a.py
...
RefactoringTool: Can't parse .\a.py: ParseError: bad input: type=22, value='=', 
context=('', (1, 16))
...
---

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 329966
nosy: batterystaple456
priority: normal
severity: normal
status: open
title: 2to3 Parse Error on Python 3 print() with arguments
type: compile error
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com