Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using the stable ABI #4

Open
ncoghlan opened this issue Jan 12, 2014 · 7 comments
Open

Switch to using the stable ABI #4

ncoghlan opened this issue Jan 12, 2014 · 7 comments

Comments

@ncoghlan
Copy link
Collaborator

It should be possible to implement asciicompat using the stable ABI, which will make it easier to maintain (a single binary will work on all Python version 3.2+).

The main changes needed will to define PY_LIMITED_API before importing python.h and to switch to use PyType_FromSpec rather than the legacy type declaration model.

The docs about this are rather suboptimal (see http://bugs.python.org/issue20224).

@jeamland
Copy link
Owner

How does one implement the buffer API with that approach?

@jeamland
Copy link
Owner

Also how do I declare a subtype of unicode without PyType_FromSpecWithBases which appears to be limited to 3.3 and up?

@ncoghlan
Copy link
Collaborator Author

You can't support 3.2 with it, but I suspect we'll end up needing 3.3+ for
interop bug fixes anyway.

However, it's probably worth waiting and seeing how far we can get while
supporting 3.2.

@ncoghlan
Copy link
Collaborator Author

Implementing the buffer API should be like implementing any other slot. The
best docs for that are currently in PEP 384.

@ncoghlan
Copy link
Collaborator Author

Ah, now I remember why 3.3 is already the minimum version - we need the
compact internal layout from PEP 393 in order to easily expose the array of
bytes.

@jeamland
Copy link
Owner

From PEP 384:

The buffer interface (type Py_buffer, type slots bf_getbuffer and bf_releasebuffer, etc) has been omitted from the
ABI, since the stability of the Py_buffer structure is not clear at this time. Inclusion in the ABI can be considered in
future releases.

And from CPython 3.4.0b2, Include/typeslots.h:

/* Disabled, see #10181 */
#undef Py_bf_getbuffer
#undef Py_bf_releasebuffer

@ncoghlan
Copy link
Collaborator Author

Oh, damn - we forgot to change that after Stefan fixed the back end in
Python 3.3. OK, static type it is, then. Could you do me a favour and file
an issue about that for Python 3.5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants