[pypy-commit] pypy py3k: Various translation fixes
amauryfa
noreply at buildbot.pypy.org
Sat Oct 22 00:28:38 CEST 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r48331:dd152a06badd
Date: 2011-10-22 00:24 +0200
http://bitbucket.org/pypy/pypy/changeset/dd152a06badd/
Log: Various translation fixes
diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -43,13 +43,11 @@
space.w_bytes)))):
if decode:
msg = ("decoding error handler must return "
- "(unicode, int) tuple, not %s")
+ "(str, int) tuple")
else:
msg = ("encoding error handler must return "
- "(unicode, int) tuple, not %s")
- raise operationerrfmt(
- space.w_TypeError, msg,
- space.unicode_w(space.repr(w_res)))
+ "(str/bytes, int) tuple")
+ raise OperationError(space.w_TypeError, space.wrap(msg))
w_replace, w_newpos = space.fixedview(w_res, 2)
newpos = space.int_w(w_newpos)
if newpos < 0:
diff --git a/pypy/module/_lsprof/interp_lsprof.py b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -194,7 +194,7 @@
# try to get the real class that defines the method,
# which is a superclass of the class of the instance
from pypy.objspace.std.typeobject import W_TypeObject # xxx
- w_type = w_arg.w_class
+ w_type = space.type(w_arg.w_instance)
class_name = w_type.getname(space) # if the rest doesn't work
if isinstance(w_type, W_TypeObject) and name != '?':
w_realclass, _ = space.lookup_in_type_where(w_type, name)
diff --git a/pypy/module/_lsprof/test/test_cprofile.py b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -41,7 +41,7 @@
entries = {}
for entry in stats:
if not hasattr(entry.code, 'co_name'):
- print entry.code
+ print(entry.code)
else:
entries[entry.code.co_name] = entry
efoo = entries['foo']
@@ -137,7 +137,7 @@
results.append(timer() - start_timer)
for methodname in methodnames:
import pstats
- from StringIO import StringIO
+ from io import StringIO
s = StringIO()
stats = pstats.Stats(prof, stream=s)
stats.strip_dirs().sort_stats("stdname")
@@ -168,12 +168,12 @@
lines.remove(line)
break
else:
- print 'NOT FOUND:', pattern.rstrip('\n')
- print '--- GOT ---'
- print got
- print
- print '--- EXPECTED ---'
- print expected
+ print('NOT FOUND:', pattern.rstrip('\n'))
+ print('--- GOT ---')
+ print(got)
+ print()
+ print('--- EXPECTED ---')
+ print(expected)
assert False
assert not lines
finally:
diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -453,7 +453,7 @@
from pypy.interpreter.unicodehelper import PyUnicode_DecodeUTF8
return space.wrap(PyUnicode_DecodeUTF8(space, s))
else:
- return space.wrap(s)
+ return space.wrapbytes(s)
def w_convert_charp(self, space, data):
if data:
@@ -552,7 +552,7 @@
# Yes, supports only 8bit encodings
translationmap = space.unicode_w(
space.call_method(
- space.wrap(self.all_chars), "decode",
+ space.wrapbytes(self.all_chars), "decode",
space.wrap(name), space.wrap("replace")))
for i in range(256):
@@ -808,5 +808,5 @@
def ErrorString(space, code):
"""ErrorString(errno) -> string
Returns string error for given number."""
- return space.wrap(rffi.charp2str(XML_ErrorString(code)))
+ return space.wrapbytes(rffi.charp2str(XML_ErrorString(code)))
More information about the pypy-commit
mailing list