[New-bugs-announce] [issue10384] SyntaxError should contain exact location of the invalid character in identifier

Alexander Belopolsky report at bugs.python.org
Thu Nov 11 02:34:45 CET 2010


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

Can you see the error in the following?

>>> inv​alid = 5
  File "<stdin>", line 1
    inv​alid = 5
             ^
SyntaxError: invalid character in identifier

The problem is that an invisible space character crept into the identifier:

>>> repr("inv​alid")
"'inv\\u200balid'"

With full unicode available in most OSes, the potential for errors like this (accidental or as a result of a practical joke) increases.  It would be much easier to spot the offending character if ^ marker pointed at the exact location rather than at the end of the identifier.


See also issue #10382.

----------
components: Interpreter Core
messages: 120936
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: SyntaxError should contain exact location of the invalid character in identifier
type: feature request
versions: Python 3.2

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


More information about the New-bugs-announce mailing list