Author: Anthony Sottile <[email protected]>
Branch: py_ssize_t
Changeset: r92356:46c6c05fde4b
Date: 2017-09-07 19:43 -0700
http://bitbucket.org/pypy/pypy/changeset/46c6c05fde4b/

Log:    Explicitly use Py_ssize_t as the Signed type in pypy c-api.

        The signature for the c-api uses Py_ssize_t for the unsigned
        arguments. `long` is equivalent to `Py_ssize_t` (in fact
        `Py_ssize_t` is a `typedef` of `long`) in all cases in C, but when
        integrating with go, `C.long` and `C.Py_ssize_t` are considered two
        disparate incompatible types. By using `Py_ssize_t` in the function
        signature, pypy + cpython compatible code can be written.

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
@@ -1229,7 +1229,8 @@
 #  error "PyPy does not support 64-bit on Windows.  Use Win32"
 #endif
 ''',
-        '#define Signed   long           /* xxx temporary fix */',
+        '#include "cpyext_object.h"',
+        '#define Signed   Py_ssize_t     /* xxx temporary fix */',
         '#define Unsigned unsigned long  /* xxx temporary fix */',
         '',] + decls + [
         '',
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to