This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Matt.Bachmann
Recipients Matt.Bachmann, ezio.melotti, vstinner
Date 2015-01-18.05:44:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1421559881.85.0.938769960217.issue23263@psf.upfronthosting.co.za>
In-reply-to
Content
PEP 3131 changed the definition of valid identifiers to match this pattern

<XID_Start> <XID_Continue>* .

Currently if you have an invalid character in an identifier you get this error

☺ = 4
SyntaxError: invalid character in identifier


This is fine in most cases. But in some cases the problem is not the character is invalid so much as the character may not be used to START the identifier. One example of this is the "combining grave accent" which is an XID_CONTINUE character but not an XID_START

So ̀e is an invalid identifier but è is a valid identifier. So the ̀ character is not invalid in all cases.

The attached patch attempts to clarify this by providing a different error when the start character is invalid.

>>> ̀e = 4
  File "<stdin>", line 1
    ̀e = 4
     ^
SyntaxError: invalid start character in identifier

However, if the character is simply not allowed (as it is neither an XID_START or an XID_CONTINUE character) the original error is used.
>>> ☺smile = 4
  File "<stdin>", line 1
    ☺smile = 4
         ^
SyntaxError: invalid character in identifier
History
Date User Action Args
2015-01-18 05:44:41Matt.Bachmannsetrecipients: + Matt.Bachmann, vstinner, ezio.melotti
2015-01-18 05:44:41Matt.Bachmannsetmessageid: <1421559881.85.0.938769960217.issue23263@psf.upfronthosting.co.za>
2015-01-18 05:44:41Matt.Bachmannlinkissue23263 messages
2015-01-18 05:44:41Matt.Bachmanncreate