[pypy-svn] r14821 - pypy/branch/pypy-translation-snapshot/objspace/std

ac at codespeak.net ac at codespeak.net
Wed Jul 20 17:00:01 CEST 2005


Author: ac
Date: Wed Jul 20 17:00:00 2005
New Revision: 14821

Modified:
   pypy/branch/pypy-translation-snapshot/objspace/std/intobject.py
Log:
Merge changes of intobject from trunk.

Modified: pypy/branch/pypy-translation-snapshot/objspace/std/intobject.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/objspace/std/intobject.py	(original)
+++ pypy/branch/pypy-translation-snapshot/objspace/std/intobject.py	Wed Jul 20 17:00:00 2005
@@ -209,13 +209,8 @@
     m = x % y
     return space.wrap((z,m))
 
-old_style_div = 1 / 2 == 1 // 2
 def div__Int_Int(space, w_int1, w_int2):
-    # Select the proper div
-    if old_style_div:
-        return _floordiv(space, w_int1, w_int2)
-    else:
-        return _truediv(space, w_int1, w_int2)
+    return _floordiv(space, w_int1, w_int2)
 
 floordiv__Int_Int = _floordiv
 truediv__Int_Int = _truediv
@@ -409,31 +404,10 @@
     return space.newfloat(x)
 
 def oct__Int(space, w_int1):
-    x = w_int1.intval
-    if x < 0:
-        ## XXX what about this warning?
-        #if (PyErr_Warn(PyExc_FutureWarning,
-        #           "hex()/oct() of negative int will return "
-        #           "a signed string in Python 2.4 and up") < 0)
-        #    return NULL;
-        pass
-    if x == 0:
-        ret = "0"
-    else:
-        ret = "0%lo" % x
-    return space.wrap(ret)
+    return space.wrap(oct(w_int1.intval))
 
 def hex__Int(space, w_int1):
-    x = w_int1.intval
-    if x < 0:
-        ## XXX what about this warning?
-        #if (PyErr_Warn(PyExc_FutureWarning,
-        #           "hex()/oct() of negative int will return "
-        #           "a signed string in Python 2.4 and up") < 0)
-        #    return NULL;
-        pass
-    ret = "0x%lx" % x
-    return space.wrap(ret)
+    return space.wrap(hex(w_int1.intval))
 
 def getnewargs__Int(space, w_int1):
     return space.newtuple([W_IntObject(space, w_int1.intval)])



More information about the Pypy-commit mailing list