Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r63032:edd8750a09ee
Date: 2013-04-04 16:13 -0700
http://bitbucket.org/pypy/pypy/changeset/edd8750a09ee/
Log: cleanup long's class hierarchy: stop using W_AbstractIntObject.
fixes unwrapping of smalllongs
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
@@ -20,7 +20,7 @@
__slots__ = 'intval'
_immutable_fields_ = ['intval']
- from pypy.objspace.std.longtype import long_typedef as typedef
+# from pypy.objspace.std.inttype import int_typedef as typedef
def __init__(w_self, intval):
assert is_valid_int(intval)
@@ -57,7 +57,7 @@
a = self.intval
return wrapint(space, a)
-registerimplementation(W_IntObject)
+#registerimplementation(W_IntObject)
# NB: This code is shared by smallintobject.py, and thus no other Int
# multimethods should be invoked from these implementations. Instead, add an
diff --git a/pypy/objspace/std/longobject.py b/pypy/objspace/std/longobject.py
--- a/pypy/objspace/std/longobject.py
+++ b/pypy/objspace/std/longobject.py
@@ -4,13 +4,13 @@
from pypy.objspace.std.model import registerimplementation, W_Object
from pypy.objspace.std.register_all import register_all
from pypy.objspace.std.multimethod import FailedToImplementArgs
-from pypy.objspace.std.intobject import W_IntObject, W_AbstractIntObject
+from pypy.objspace.std.intobject import W_IntObject
from pypy.objspace.std.noneobject import W_NoneObject
from rpython.rlib.rbigint import rbigint
-from pypy.objspace.std.longtype import long_typedef
+from pypy.objspace.std.longtype import long_typedef, W_AbstractLongObject
-class W_LongObject(W_AbstractIntObject):
+class W_LongObject(W_AbstractLongObject):
"""This is a wrapper of rbigint."""
_immutable_fields_ = ['num']
diff --git a/pypy/objspace/std/longtype.py b/pypy/objspace/std/longtype.py
--- a/pypy/objspace/std/longtype.py
+++ b/pypy/objspace/std/longtype.py
@@ -182,8 +182,8 @@
m - divmod_near(m, 10**n)[1]
"""
- from pypy.objspace.std.longobject import W_AbstractIntObject, newlong
- assert isinstance(w_long, W_AbstractIntObject)
+ from pypy.objspace.std.longobject import newlong
+ assert isinstance(w_long, W_AbstractLongObject)
if w_ndigits is None:
return space.int(w_long)
diff --git a/pypy/objspace/std/model.py b/pypy/objspace/std/model.py
--- a/pypy/objspace/std/model.py
+++ b/pypy/objspace/std/model.py
@@ -86,7 +86,7 @@
self.typeorder = {
objectobject.W_ObjectObject: [],
boolobject.W_BoolObject: [],
- intobject.W_IntObject: [],
+ #intobject.W_IntObject: [],
floatobject.W_FloatObject: [],
tupleobject.W_TupleObject: [],
listobject.W_ListObject: [],
@@ -161,24 +161,24 @@
register_delegates(self.typeorder)
self.typeorder[boolobject.W_BoolObject] += [
- (intobject.W_IntObject, boolobject.delegate_Bool2IntObject),
+ #(intobject.W_IntObject, boolobject.delegate_Bool2IntObject),
(floatobject.W_FloatObject, floatobject.delegate_Bool2Float),
(longobject.W_LongObject, longobject.delegate_Bool2Long),
(complexobject.W_ComplexObject,
complexobject.delegate_Bool2Complex),
]
- self.typeorder[intobject.W_IntObject] += [
- (longobject.W_LongObject, longobject.delegate_Int2Long),
- (floatobject.W_FloatObject, floatobject.delegate_Int2Float),
- (complexobject.W_ComplexObject,
complexobject.delegate_Int2Complex),
- ]
+ #self.typeorder[intobject.W_IntObject] += [
+ # (longobject.W_LongObject, longobject.delegate_Int2Long),
+ # (floatobject.W_FloatObject, floatobject.delegate_Int2Float),
+ # (complexobject.W_ComplexObject,
complexobject.delegate_Int2Complex),
+ # ]
if config.objspace.std.withsmalllong:
from pypy.objspace.std import smalllongobject
self.typeorder[boolobject.W_BoolObject] += [
(smalllongobject.W_SmallLongObject,
smalllongobject.delegate_Bool2SmallLong),
]
- self.typeorder[intobject.W_IntObject] += [
- (smalllongobject.W_SmallLongObject,
smalllongobject.delegate_Int2SmallLong),
- ]
+ #self.typeorder[intobject.W_IntObject] += [
+ # (smalllongobject.W_SmallLongObject,
smalllongobject.delegate_Int2SmallLong),
+ # ]
self.typeorder[smalllongobject.W_SmallLongObject] += [
(longobject.W_LongObject,
smalllongobject.delegate_SmallLong2Long),
(floatobject.W_FloatObject,
smalllongobject.delegate_SmallLong2Float),
@@ -229,6 +229,7 @@
# Prebuilt common integer values
if config.objspace.std.withprebuiltint:
+ # XXX: currently broken on py3k
intobject.W_IntObject.PREBUILT = []
for i in range(config.objspace.std.prebuiltintfrom,
config.objspace.std.prebuiltintto):
diff --git a/pypy/objspace/std/smalllongobject.py
b/pypy/objspace/std/smalllongobject.py
--- a/pypy/objspace/std/smalllongobject.py
+++ b/pypy/objspace/std/smalllongobject.py
@@ -9,7 +9,7 @@
from rpython.rlib.rarithmetic import r_longlong, r_int, r_uint
from rpython.rlib.rarithmetic import intmask, LONGLONG_BIT
from rpython.rlib.rbigint import rbigint
-from pypy.objspace.std.longobject import W_AbstractIntObject, W_LongObject
+from pypy.objspace.std.longobject import W_AbstractLongObject, W_LongObject
from pypy.objspace.std.intobject import W_IntObject
from pypy.objspace.std.noneobject import W_NoneObject
from pypy.interpreter.error import OperationError
@@ -17,7 +17,7 @@
LONGLONG_MIN = r_longlong((-1) << (LONGLONG_BIT-1))
-class W_SmallLongObject(W_AbstractIntObject):
+class W_SmallLongObject(W_AbstractLongObject):
from pypy.objspace.std.longtype import long_typedef as typedef
_immutable_fields_ = ['longlong']
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit