mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Implement PEP 393.
This commit is contained in:
parent
48d49497c5
commit
d63a3b8beb
102 changed files with 8153 additions and 5431 deletions
|
@ -1258,14 +1258,16 @@ indenterror(struct tok_state *tok)
|
|||
#ifdef PGEN
|
||||
#define verify_identifier(tok) 1
|
||||
#else
|
||||
/* Verify that the identifier follows PEP 3131. */
|
||||
/* Verify that the identifier follows PEP 3131.
|
||||
All identifier strings are guaranteed to be "ready" unicode objects.
|
||||
*/
|
||||
static int
|
||||
verify_identifier(struct tok_state *tok)
|
||||
{
|
||||
PyObject *s;
|
||||
int result;
|
||||
s = PyUnicode_DecodeUTF8(tok->start, tok->cur - tok->start, NULL);
|
||||
if (s == NULL) {
|
||||
if (s == NULL || PyUnicode_READY(s) == -1) {
|
||||
if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
|
||||
PyErr_Clear();
|
||||
tok->done = E_IDENTIFIER;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue