[New-bugs-announce] [issue44409] compile raises SyntaxError with undocumented lineno attribute None

Florian Weimer report at bugs.python.org
Sun Jun 13 07:25:16 EDT 2021


New submission from Florian Weimer <fweimer at 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 <report at bugs.python.org>
<https://bugs.python.org/issue44409>
_______________________________________


More information about the New-bugs-announce mailing list