[pypy-commit] pypy py3k: cleanup

pjenvey noreply at buildbot.pypy.org
Mon Oct 29 20:34:57 CET 2012


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r58598:48d6dbdb7f81
Date: 2012-10-29 12:32 -0700
http://bitbucket.org/pypy/pypy/changeset/48d6dbdb7f81/

Log:	cleanup

diff --git a/pypy/objspace/std/unicodetype.py b/pypy/objspace/std/unicodetype.py
--- a/pypy/objspace/std/unicodetype.py
+++ b/pypy/objspace/std/unicodetype.py
@@ -261,9 +261,9 @@
 def unicode_from_object(space, w_obj):
     if space.is_w(space.type(w_obj), space.w_unicode):
         return w_obj
-
-    w_unicode_method = space.lookup(w_obj, "__str__")
-    return space.repr(w_obj) if w_unicode_method is None else space.str(w_obj)
+    if space.lookup(w_obj, "__str__") is not None:
+        return space.str(w_obj)
+    return space.repr(w_obj)
 
 def ascii_from_object(space, w_obj):
     """Implements builtins.ascii()"""


More information about the pypy-commit mailing list