[issue40813] Output SyntaxError is not defective

2020-09-24 Thread Irit Katriel


Irit Katriel  added the comment:

I don't think it's true that the lineno is correct when compiling a string 
(Remi's string is just too short):

>>> try:
... compile('if __name__ == "__main__":\n   print("hello world"\n   x=5\n', 
'', 'exec')
... except SyntaxError as e:
... print("e.lineno=", e.lineno)
... print("e.offset=", e.offset)
... print("e.text=", e.text)
...
e.lineno= 3
e.offset= 4
e.text=x=5
>>>


Arguably the syntax error is on line 3. Line 2 can be complemented by a line 3 
that will make it valid.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue40813] Output SyntaxError is not defective

2020-05-29 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Indeed, the exception has the correct line number when compiling manually:


>>> try:
... compile('if __name__ == "__main__":\n   print("hello world"\n', 
'', 'exec')
... except SyntaxError as e:
... print(e.lineno)
...
2


but not when running `python3 main.py`:
  File "main.py", line 3

  ^
SyntaxError: unexpected EOF while parsing



I tried with all version of Python >= 3.6 and Python2 and they all exhibit the 
same behavior.

--
nosy: +remi.lapeyre
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue40813] Output SyntaxError is not defective

2020-05-29 Thread timofej


timofej  added the comment:

About of numbers of line. I tested on different files and i forget change 
number of line.

--

___
Python tracker 

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



[issue40813] Output SyntaxError is not defective

2020-05-29 Thread timofej


timofej  added the comment:

here attached file with SyntaxError

--
Added file: https://bugs.python.org/file49201/main.py

___
Python tracker 

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



[issue40813] Output SyntaxError is not defective

2020-05-29 Thread Zachary Ware


Change by Zachary Ware :


--
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



[issue40813] Output SyntaxError is not defective

2020-05-29 Thread Zachary Ware


Zachary Ware  added the comment:

Without some example code, there's no way to really tell what's going on here.  
In particular, it's suspicious that you're expecting an error on line 7 but 
seeing one on line 3.

Can you attach your `main.py` file to the issue?

--
components: +Interpreter Core -Build
nosy: +zach.ware

___
Python tracker 

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



[issue40813] Output SyntaxError is not defective

2020-05-29 Thread timofej


New submission from timofej :

a SyntaxError must be look like:

File "main.py", line 7
print("hello world"
  ^
SyntaxError: unexpected EOF while parsing

but instead of this i'm get this:

File "main.py", line 3

   ^
SyntaxError: unexpected EOF while parsing

It seems to me that this problem is only in windows.

--
components: Build
messages: 370287
nosy: timofej
priority: normal
severity: normal
status: open
title: Output SyntaxError is not defective
type: compile error
versions: Python 3.8

___
Python tracker 

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