Author: Matti Picus <[email protected]>
Branch:
Changeset: r94778:6e529ed6ae8e
Date: 2018-06-24 20:33 -0700
http://bitbucket.org/pypy/pypy/changeset/6e529ed6ae8e/
Log: fix #2851, define and use INTP_real as 'int*' for windows
compatability
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -772,6 +772,9 @@
# a pointer to PyObject
PyObjectP = rffi.CArrayPtr(PyObject)
+# int *
+INTP_real = rffi.CArrayPtr(rffi.INT_real)
+
def configure_types():
for config in (CConfig, CConfig2):
for name, TYPE in rffi_platform.configure(config).iteritems():
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
@@ -1,7 +1,7 @@
from rpython.rtyper.lltypesystem import lltype, rffi
from pypy.module.cpyext.api import (
cpython_api, PyObject, build_type_checkers_flags, Py_ssize_t,
- CONST_STRING, ADDR, CANNOT_FAIL)
+ CONST_STRING, ADDR, CANNOT_FAIL, INTP_real)
from pypy.objspace.std.longobject import W_LongObject
from pypy.interpreter.error import OperationError, oefmt
from pypy.module.cpyext.intobject import PyInt_AsUnsignedLongMask
@@ -112,7 +112,7 @@
num = space.bigint_w(w_long)
return num.ulonglongmask()
-@cpython_api([PyObject, rffi.CArrayPtr(rffi.INT_real)], lltype.Signed,
+@cpython_api([PyObject, INTP_real], lltype.Signed,
error=-1)
def PyLong_AsLongAndOverflow(space, w_long, overflow_ptr):
"""
diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -1,7 +1,7 @@
from rpython.rtyper.lltypesystem import rffi, lltype
from pypy.module.cpyext.api import (
cpython_api, generic_cpy_call, CANNOT_FAIL, Py_ssize_t, Py_ssize_tP,
- PyVarObject, size_t, slot_function,
+ PyVarObject, size_t, slot_function, INTP_real,
Py_TPFLAGS_HEAPTYPE, Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT,
Py_GE, CONST_STRING, FILEP, fwrite, c_only)
from pypy.module.cpyext.pyobject import (
@@ -221,7 +221,7 @@
expression cmp(o1, o2)."""
return space.int_w(space.cmp(w_o1, w_o2))
-@cpython_api([PyObject, PyObject, rffi.INTP], rffi.INT_real, error=-1)
+@cpython_api([PyObject, PyObject, INTP_real], rffi.INT_real, error=-1)
def PyObject_Cmp(space, w_o1, w_o2, result):
"""Compare the values of o1 and o2 using a routine provided by o1, if one
exists, otherwise with a routine provided by o2. The result of the
diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py
--- a/pypy/module/cpyext/pystrtod.py
+++ b/pypy/module/cpyext/pystrtod.py
@@ -1,6 +1,6 @@
import errno
from pypy.interpreter.error import oefmt
-from pypy.module.cpyext.api import cpython_api, CONST_STRING
+from pypy.module.cpyext.api import cpython_api, CONST_STRING, INTP_real
from pypy.module.cpyext.pyobject import PyObject
from rpython.rlib import rdtoa
from rpython.rlib import rfloat
@@ -80,7 +80,7 @@
if not user_endptr:
lltype.free(endptr, flavor='raw')
-@cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real,
rffi.INTP], rffi.CCHARP)
+@cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real,
INTP_real], rffi.CCHARP)
def PyOS_double_to_string(space, val, format_code, precision, flags, ptype):
"""Convert a double val to a string using supplied
format_code, precision, and flags.
diff --git a/pypy/module/cpyext/unicodeobject.py
b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -3,7 +3,7 @@
from pypy.module.unicodedata import unicodedb
from pypy.module.cpyext.api import (
CANNOT_FAIL, Py_ssize_t, build_type_checkers_flags, cpython_api,
- bootstrap_function, CONST_STRING,
+ bootstrap_function, CONST_STRING, INTP_real,
CONST_WSTRING, slot_function, cts, parse_dir)
from pypy.module.cpyext.pyerrors import PyErr_BadArgument
from pypy.module.cpyext.pyobject import (
@@ -526,7 +526,7 @@
if sys.platform == 'win32':
make_conversion_functions('MBCS', 'mbcs')
-@cpython_api([CONST_STRING, Py_ssize_t, CONST_STRING, rffi.INTP], PyObject)
+@cpython_api([CONST_STRING, Py_ssize_t, CONST_STRING, INTP_real], PyObject)
def PyUnicode_DecodeUTF16(space, s, size, llerrors, pbyteorder):
"""Decode length bytes from a UTF-16 encoded buffer string and return the
corresponding Unicode object. errors (if non-NULL) defines the error
@@ -580,7 +580,7 @@
return space.newunicode(result)
-@cpython_api([CONST_STRING, Py_ssize_t, CONST_STRING, rffi.INTP], PyObject)
+@cpython_api([CONST_STRING, Py_ssize_t, CONST_STRING, INTP_real], PyObject)
def PyUnicode_DecodeUTF32(space, s, size, llerrors, pbyteorder):
"""Decode length bytes from a UTF-32 encoded buffer string and
return the corresponding Unicode object. errors (if non-NULL)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit