Message234222
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 |
|
Date |
User |
Action |
Args |
2015-01-18 05:44:41 | Matt.Bachmann | set | recipients:
+ Matt.Bachmann, vstinner, ezio.melotti |
2015-01-18 05:44:41 | Matt.Bachmann | set | messageid: <1421559881.85.0.938769960217.issue23263@psf.upfronthosting.co.za> |
2015-01-18 05:44:41 | Matt.Bachmann | link | issue23263 messages |
2015-01-18 05:44:41 | Matt.Bachmann | create | |
|