New submission from Florian Weimer <fwei...@redhat.com>:

This example results in an undocumented value None for the lineno attribute:

```
source = b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n"

try:
    compile(source, filename="example.py", mode="exec")
except SyntaxError as e:
    print(str(e))
    print(type(e.lineno))
```

Output:

```
encoding problem: utf8 with BOM
<class 'NoneType'>
```

Seen with python3-3.9.5-2.fc33.x86_64.

python3-3.8.10-1.fc32.x86_64 used a lineno value of 0 (type int).

----------
components: Parser
messages: 395740
nosy: fweimer, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: compile raises SyntaxError with undocumented lineno attribute None
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44409>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to