Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8daa49e

Browse files
committed
Merged revisions 79723 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r79723 | benjamin.peterson | 2010-04-03 17:48:51 -0500 (Sat, 03 Apr 2010) | 1 line ensure that the locale does not affect the tokenization of identifiers ........
1 parent ace7108 commit 8daa49e

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ What's New in Python 3.2 Alpha 1?
1212
Core and Builtins
1313
-----------------
1414

15+
- Ensure that tokenization of identifiers is not affected by locale.
16+
1517
- Issue #1222585: Added LDCXXSHARED for C++ support. Patch by Arfrever.
1618

1719
- Raise a TypeError when trying to delete a T_STRING_INPLACE struct member.

Parser/tokenizer.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ decode_str(const char *str, int exec_input, struct tok_state *tok)
179179

180180
#else /* PGEN */
181181

182+
/* Ensure that the locale does not interfere with tokenization. */
183+
184+
static int
185+
ascii_isalnum(int c)
186+
{
187+
return (('a' <= c && c <= 'z') ||
188+
('A' <= c && c <= 'Z') ||
189+
('0' <= c && c <= '9'));
190+
}
191+
182192
static char *
183193
error_ret(struct tok_state *tok) /* XXX */
184194
{
@@ -245,7 +255,7 @@ get_coding_spec(const char *s, Py_ssize_t size)
245255
} while (t[0] == '\x20' || t[0] == '\t');
246256

247257
begin = t;
248-
while (isalnum(Py_CHARMASK(t[0])) ||
258+
while (ascii_isalnum(Py_CHARMASK(t[0])) ||
249259
t[0] == '-' || t[0] == '_' || t[0] == '.')
250260
t++;
251261

0 commit comments

Comments
 (0)