![](https://secure.gravatar.com/avatar/2f2ca3900ef33896dbd5d158c803d4bd.jpg?s=120&d=mm&r=g)
Hi Stian, Could the sign check be please put into a nice helper method on rbigint objects? I find it not so nice that longobject.py pokes around in the internals of the big integer implementation. Cheers, Carl Friedrich On 11/05/2012 03:43 PM, Stian Andreassen wrote:
Author: Stian Andreassen Branch: Changeset: r58761:bc1b37bec5b3 Date: 2012-11-05 23:41 +0100 http://bitbucket.org/pypy/pypy/changeset/bc1b37bec5b3/
Log: Do sign checks directly.
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 @@ -251,7 +251,7 @@
def pow__Long_Long_Long(space, w_long1, w_long2, w_long3): # XXX need to replicate some of the logic, to get the errors right - if w_long2.num.lt(rbigint.fromint(0)): + if w_long2.num.sign < 0: raise OperationError( space.w_TypeError, space.wrap( @@ -265,7 +265,7 @@
def pow__Long_Long_None(space, w_long1, w_long2, w_long3): # XXX need to replicate some of the logic, to get the errors right - if w_long2.num.lt(rbigint.fromint(0)): + if w_long2.num.sign < 0: raise FailedToImplementArgs( space.w_ValueError, space.wrap("long pow() too negative")) @@ -288,7 +288,7 @@
def lshift__Long_Long(space, w_long1, w_long2): # XXX need to replicate some of the logic, to get the errors right - if w_long2.num.lt(rbigint.fromint(0)): + if w_long2.num.sign < 0: raise OperationError(space.w_ValueError, space.wrap("negative shift count")) try: @@ -300,7 +300,7 @@
def rshift__Long_Long(space, w_long1, w_long2): # XXX need to replicate some of the logic, to get the errors right - if w_long2.num.lt(rbigint.fromint(0)): + if w_long2.num.sign < 0: raise OperationError(space.w_ValueError, space.wrap("negative shift count")) try: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit