[pypy-commit] pypy py3k: avoid the overridable via subclass encode method

pjenvey noreply at buildbot.pypy.org
Fri Sep 12 00:15:23 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r73489:a9fef4fe325f
Date: 2014-09-11 15:12 -0700
http://bitbucket.org/pypy/pypy/changeset/a9fef4fe325f/

Log:	avoid the overridable via subclass encode method

diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -8,6 +8,7 @@
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 from pypy.interpreter.error import OperationError, oefmt
+from pypy.interpreter.unicodehelper import encode
 
 cwd = py.path.local(__file__).dirpath()
 eci = ExternalCompilationInfo(
@@ -44,8 +45,8 @@
     if (space.isinstance_w(w_a, space.w_unicode) and
         space.isinstance_w(w_b, space.w_unicode)):
         try:
-            w_a = space.call_method(w_a, 'encode', space.wrap('ascii'))
-            w_b = space.call_method(w_b, 'encode', space.wrap('ascii'))
+            w_a = encode(space, w_a, 'ascii')
+            w_b = encode(space, w_b, 'ascii')
         except OperationError as e:
             if not e.match(space, space.w_UnicodeEncodeError):
                 raise


More information about the pypy-commit mailing list