[PyPy-issue] [issue650] pypy_decl.h uses incorrect types for arguments

Martijn pypy-dev-issue at codespeak.net
Sun Feb 27 22:38:19 CET 2011


New submission from Martijn <ss at kleptog.org>:

When methods are created in cpyext they properly declare they accept Py_ssize_tP
but in pypy_decl.h it outputs long*. While for a C compiler these are the same,
a C++ compiler considers them quite different. For example:

PyAPI_FUNC(int) PyString_AsStringAndSize(PyObject *arg0, char **arg1, long *arg2);

The basic cause is because in api.py we have the line:

Py_ssize_t = lltype.Signed

Which means that the rest of the code can't distinguish the two. What you need
is a sort of typedef which means the same code is produced, but a different name
is used in the C output. I tried subclassing but that made errors relating to
metaclasses. Maybe there is another solution?

----------
effort: ???
messages: 2190
nosy: kleptog, pypy-issue
priority: bug
release: ???
status: unread
title: pypy_decl.h uses incorrect types for arguments

_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue650>
_______________________________________________________



More information about the Pypy-issue mailing list