Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r74856:f91fe709f1b0
Date: 2014-12-07 20:32 -0800
http://bitbucket.org/pypy/pypy/changeset/f91fe709f1b0/
Log: adapt to py3
diff --git a/pypy/interpreter/astcompiler/misc.py
b/pypy/interpreter/astcompiler/misc.py
--- a/pypy/interpreter/astcompiler/misc.py
+++ b/pypy/interpreter/astcompiler/misc.py
@@ -110,12 +110,11 @@
def intern_if_common_string(space, w_const):
# only intern identifier-like strings
- if not space.is_w(space.type(w_const), space.w_str):
- return w_const
- for c in space.str_w(w_const):
- if not (c.isalnum() or c == '_'):
- return w_const
- return space.new_interned_w_str(w_const)
+ from pypy.objspace.std.unicodeobject import _isidentifier
+ if (space.is_w(space.type(w_const), space.w_unicode) and
+ _isidentifier(space.unicode_w(w_const))):
+ return space.new_interned_w_str(w_const)
+ return w_const
def new_identifier(space, name):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit