Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r92374:d9fa892ead1e
Date: 2017-09-11 18:21 +0100
http://bitbucket.org/pypy/pypy/changeset/d9fa892ead1e/
Log: Add space.long and space.w_long aliases and reduce diff with default
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1625,6 +1625,7 @@
def int(self, w_obj):
assert w_obj is not None
return w_obj.int(self)
+ long = int
@specialize.argtype(1)
def uint_w(self, w_obj):
diff --git a/pypy/module/cpyext/longobject.py b/pypy/module/cpyext/longobject.py
--- a/pypy/module/cpyext/longobject.py
+++ b/pypy/module/cpyext/longobject.py
@@ -6,8 +6,7 @@
from pypy.interpreter.error import OperationError
from rpython.rlib.rbigint import rbigint
-
-PyLong_Check, PyLong_CheckExact = build_type_checkers_flags("Long", "w_int")
+PyLong_Check, PyLong_CheckExact = build_type_checkers_flags("Long")
@cpython_api([lltype.Signed], PyObject)
def PyLong_FromLong(space, val):
@@ -167,7 +166,7 @@
@cpython_api([lltype.Float], PyObject)
def PyLong_FromDouble(space, val):
"""Return a new PyLongObject object from v, or NULL on failure."""
- return space.int(space.newfloat(val))
+ return space.long(space.newfloat(val))
@cpython_api([PyObject], lltype.Float, error=-1.0)
def PyLong_AsDouble(space, w_long):
@@ -192,7 +191,7 @@
w_base = space.newint(rffi.cast(lltype.Signed, base))
if pend:
pend[0] = rffi.ptradd(str, len(s))
- return space.call_function(space.w_int, w_str, w_base)
+ return space.call_function(space.w_long, w_str, w_base)
@cpython_api([rffi.CWCHARP, Py_ssize_t, rffi.INT_real], PyObject)
def PyLong_FromUnicode(space, u, length, base):
@@ -203,7 +202,7 @@
out of range, ValueError will be raised."""
w_value = space.newunicode(rffi.wcharpsize2unicode(u, length))
w_base = space.newint(rffi.cast(lltype.Signed, base))
- return space.call_function(space.w_int, w_value, w_base)
+ return space.call_function(space.w_long, w_value, w_base)
@cpython_api([rffi.VOIDP], PyObject)
def PyLong_FromVoidPtr(space, p):
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -95,6 +95,7 @@
self.w_unicode = self.w_str
self.w_text = self.w_str
del self.w_str
+ self.w_long = self.w_int
self.w_dict.flag_map_or_seq = 'M'
from pypy.objspace.std import dictproxyobject
dictproxyobject._set_flag_map_or_seq(self)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit