[New-bugs-announce] [issue26152] A non-breaking space in a source

Adam Bartoš report at bugs.python.org
Tue Jan 19 07:01:37 EST 2016


New submission from Adam Bartoš:

Consider the following code:
>>> 1, 2
  File "<stdin>", line 1
    1, 2
       ^
SyntaxError: invalid character in identifier

The error is due to the fact, that the space before "2" is actually a non-breaking space. The error message and the position of the caret is misleading.

The tokenize module gives an ERRORTOKEN at the position of the space, so shouldn't the massage be more like "invalid syntax" with the correct position or even something more appropriate?

----------
components: Interpreter Core, Unicode
messages: 258584
nosy: Drekin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: A non-breaking space in a source
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26152>
_______________________________________


More information about the New-bugs-announce mailing list