Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r57962:f3a3a83a6f7d
Date: 2012-10-09 17:54 -0700
http://bitbucket.org/pypy/pypy/changeset/f3a3a83a6f7d/
Log: update ascii per runicode changes
diff --git a/pypy/module/__builtin__/operation.py
b/pypy/module/__builtin__/operation.py
--- a/pypy/module/__builtin__/operation.py
+++ b/pypy/module/__builtin__/operation.py
@@ -5,10 +5,9 @@
from pypy.interpreter import gateway
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import unwrap_spec
-from pypy.rlib.runicode import UNICHR, str_decode_ascii, unicode_encode_ascii
+from pypy.rlib import rfloat
from pypy.rlib.rfloat import isnan, isinf, round_double
-from pypy.rlib import rfloat
-import __builtin__
+from pypy.rlib.runicode import UNICHR
NoneNotWrapped = gateway.NoneNotWrapped
def abs(space, w_val):
@@ -22,12 +21,11 @@
object, but escape the non-ASCII characters in the string returned by
repr() using \\x, \\u or \\U escapes. This generates a string similar
to that returned by repr() in Python 2."""
- len_ = __builtin__.len
+ from pypy.objspace.std.unicodetype import decode_object, encode_object
# repr is guaranteed to be unicode
- repr = space.unicode_w(space.repr(w_obj))
- encoded = unicode_encode_ascii(repr, len_(repr), 'backslashreplace')
- decoded = str_decode_ascii(encoded, len_(encoded), None, final=True)[0]
- return space.wrap(decoded)
+ w_repr = space.repr(w_obj)
+ w_encoded = encode_object(space, w_repr, 'ascii', 'backslashreplace')
+ return decode_object(space, w_encoded, 'ascii', None)
@unwrap_spec(code=int)
def chr(space, code):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit