Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r62846:d8c011188f3f
Date: 2013-03-27 15:52 -0700
http://bitbucket.org/pypy/pypy/changeset/d8c011188f3f/
Log: restore checking __int__ on subclasses, simplify
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
@@ -70,10 +70,10 @@
return self.num.tofloat()
def int(self, space):
- try:
- return space.newint(self.num.toint())
- except OverflowError:
- return long_long(space, self)
+ if (type(self) is not W_LongObject and
+ space.is_overloaded(self, space.w_int, '__int__')):
+ return W_Object.int(self, space)
+ return long_long(space, self)
def __repr__(self):
return '<W_LongObject(%d)>' % self.num.tolong()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit