Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: 
Changeset: r62703:c9e6b6819cbb
Date: 2013-03-23 12:22 -0700
http://bitbucket.org/pypy/pypy/changeset/c9e6b6819cbb/

Log:    fix translation

diff --git a/pypy/module/_cffi_backend/cdataobj.py 
b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -56,13 +56,13 @@
     def nonzero(self):
         return self.space.wrap(bool(self._cdata))
 
-    def int(self):
-        w_result = self.ctype.int(self._cdata)
+    def int(self, space):
+        w_result = self.ctype.cast_to_int(self._cdata)
         keepalive_until_here(self)
         return w_result
 
-    def long(self):
-        w_result = self.int()
+    def long(self, space):
+        w_result = self.int(space)
         space = self.space
         if space.is_w(space.type(w_result), space.w_int):
             w_result = space.newlong(space.int_w(w_result))
diff --git a/pypy/module/_cffi_backend/ctypeobj.py 
b/pypy/module/_cffi_backend/ctypeobj.py
--- a/pypy/module/_cffi_backend/ctypeobj.py
+++ b/pypy/module/_cffi_backend/ctypeobj.py
@@ -54,7 +54,7 @@
         raise operationerrfmt(space.w_TypeError,
                               "cannot cast to '%s'", self.name)
 
-    def int(self, cdata):
+    def cast_to_int(self, cdata):
         space = self.space
         raise operationerrfmt(space.w_TypeError,
                               "int() not supported on cdata '%s'", self.name)
diff --git a/pypy/module/_cffi_backend/ctypeprim.py 
b/pypy/module/_cffi_backend/ctypeprim.py
--- a/pypy/module/_cffi_backend/ctypeprim.py
+++ b/pypy/module/_cffi_backend/ctypeprim.py
@@ -99,7 +99,7 @@
     _attrs_ = []
     cast_anything = True
 
-    def int(self, cdata):
+    def cast_to_int(self, cdata):
         return self.space.wrap(ord(cdata[0]))
 
     def convert_to_object(self, cdata):
@@ -124,7 +124,7 @@
 class W_CTypePrimitiveUniChar(W_CTypePrimitiveCharOrUniChar):
     _attrs_ = []
 
-    def int(self, cdata):
+    def cast_to_int(self, cdata):
         unichardata = rffi.cast(rffi.CWCHARP, cdata)
         return self.space.wrap(ord(unichardata[0]))
 
@@ -168,7 +168,7 @@
             self.vmin = r_uint(-1) << (sh - 1)
             self.vrangemax = (r_uint(1) << sh) - 1
 
-    def int(self, cdata):
+    def cast_to_int(self, cdata):
         return self.convert_to_object(cdata)
 
     def convert_to_object(self, cdata):
@@ -213,7 +213,7 @@
         sh = self.size * 8
         return (r_uint(1) << sh) - 1
 
-    def int(self, cdata):
+    def cast_to_int(self, cdata):
         return self.convert_to_object(cdata)
 
     def convert_from_object(self, cdata, w_ob):
@@ -288,7 +288,7 @@
             keepalive_until_here(w_cdata)
         return w_cdata
 
-    def int(self, cdata):
+    def cast_to_int(self, cdata):
         w_value = self.float(cdata)
         return self.space.int(w_value)
 
diff --git a/pypy/objspace/std/boolobject.py b/pypy/objspace/std/boolobject.py
--- a/pypy/objspace/std/boolobject.py
+++ b/pypy/objspace/std/boolobject.py
@@ -36,6 +36,8 @@
     def float_w(self, space):
         return float(self.boolval)
 
+    def int(self, space):
+        return self
 
 registerimplementation(W_BoolObject)
 
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -308,10 +308,6 @@
     res = a | b
     return wrapint(space, res)
 
-# int__Int is supposed to do nothing, unless it has
-# a derived integer object, where it should return
-# an exact one.
-
 def pos__Int(self, space):
     return self.int(space)
 trunc__Int = pos__Int
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to