Author: Armin Rigo <[email protected]>
Branch: py3.5-newtext
Changeset: r89099:cda3e3f5f13e
Date: 2016-12-16 15:00 +0100
http://bitbucket.org/pypy/pypy/changeset/cda3e3f5f13e/
Log: Replace identifier_w() with text_w() in some places where we don't
really want the "there-are-no-surrogates" check
diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -404,7 +404,7 @@
i = 0
for w_key in keys_w:
try:
- key = space.identifier_w(w_key)
+ key = space.text_w(w_key)
except OperationError as e:
if e.match(space, space.w_TypeError):
raise oefmt(space.w_TypeError,
@@ -595,7 +595,7 @@
except IndexError:
name = '?'
else:
- name = space.identifier_w(w_name)
+ name = space.text_w(w_name)
break
self.kwd_name = name
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1522,7 +1522,7 @@
if self.isinstance_w(w_obj, self.w_str):
return StringBuffer(w_obj.bytes_w(self))
if self.isinstance_w(w_obj, self.w_unicode):
- return StringBuffer(w_obj.identifier_w(self))
+ return StringBuffer(w_obj.identifier_w(self)) # no surrogates
try:
return w_obj.buffer_w(self, self.BUF_SIMPLE)
except BufferInterfaceNotFound:
@@ -1531,7 +1531,7 @@
if self.isinstance_w(w_obj, self.w_str):
return w_obj.bytes_w(self)
if self.isinstance_w(w_obj, self.w_unicode):
- return w_obj.identifier_w(self)
+ return w_obj.identifier_w(self) # no surrogates (forbidden)
try:
return w_obj.buffer_w(self, self.BUF_SIMPLE).as_str()
except BufferInterfaceNotFound:
@@ -1681,6 +1681,7 @@
This differs from space.text_w() because it raises an app-level
UnicodeEncodeError if the unicode string contains surrogates.
This corresponds exactly to 'str.encode(obj, "utf-8")' at app-level.
+ (XXX check what occurs on narrow builds or kill narrow builds!)
"""
return w_obj.identifier_w(self)
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -465,7 +465,7 @@
return self.getcode().co_consts_w[index]
def getname_u(self, index):
- return self.space.identifier_w(self.getname_w(index))
+ return self.space.text_w(self.getname_w(index))
def getname_w(self, index):
return self.getcode().co_names_w[index]
@@ -899,7 +899,7 @@
def LOAD_NAME(self, nameindex, next_instr):
w_varname = self.getname_w(nameindex)
- varname = self.space.identifier_w(w_varname)
+ varname = self.space.text_w(w_varname)
if self.getorcreatedebug().w_locals is not self.get_w_globals():
w_value = self.space.finditem_str(self.getorcreatedebug().w_locals,
varname)
@@ -929,7 +929,7 @@
@always_inline
def LOAD_GLOBAL(self, nameindex, next_instr):
w_varname = self.getname_w(nameindex)
- w_value = self._load_global(self.space.identifier_w(w_varname))
+ w_value = self._load_global(self.space.text_w(w_varname))
if w_value is None:
self._load_global_failed(w_varname)
self.pushvalue(w_value)
@@ -1257,7 +1257,7 @@
break
w_value = self.popvalue()
w_key = self.popvalue()
- key = self.space.identifier_w(w_key)
+ key = self.space.text_w(w_key)
keywords[n_keywords] = key
keywords_w[n_keywords] = w_value
else:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit