Skip to content

WIP: PyPy support #521

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

Merged
merged 1 commit into from
Nov 22, 2016
Merged

WIP: PyPy support #521

merged 1 commit into from
Nov 22, 2016

Conversation

wjakob
Copy link
Member

@wjakob wjakob commented Nov 22, 2016

This commit includes a few minor modifications to pybind11 that are
needed to get simple hello-world style functions to compile and run on
the latest PyPy.

Sadly, more complex things are still broken: for instance, creating new
types fails with the error message 'TypeError: can't set attributes on
type object <..>' when pybind11 tries to set the __module__ attribute.
Digging into the pip codebase indicates that it believes that the
underlying type is not a heap type, which is incorrect. So this is
likely a PyPy bug.

This commit includes a few minor modifications to pybind11 that are
needed to get simple hello-world style functions to compile and run on
the latest PyPy.

Sadly, more complex things are still broken: for instance, creating new
types fails with the error message 'TypeError: can't set attributes on
type object <..>' when pybind11 tries to set the __module__ attribute.
Digging into the pip codebase indicates that it believes that the
underlying type is not a heap type, which is incorrect. So this is
likely a PyPy bug.
@dean0x7d
Copy link
Member

Very interesting! How feasible is full PyPy support? Given PyPy's existing incompatibilities with the CPython API and general lean into the other direction (PyPy docs actively discourage C extension modules) I had always imagined this to be an uphill battle.

@wjakob
Copy link
Member Author

wjakob commented Nov 22, 2016

It was surprisingly easy to get it to compile, and simple functions already work. So let's see -- assuming that the issue with type creation can be fixed, it will already be good enough for many things. I'll file a ticket on the PyPy bug tracker.

@wjakob
Copy link
Member Author

wjakob commented Nov 22, 2016

@wjakob wjakob merged commit b5ac95e into pybind:master Nov 22, 2016
@wjakob
Copy link
Member Author

wjakob commented Nov 22, 2016

Whoops, I accidentally merged this in a git interactive rebase SNAFU.. Since there is no way to un-merge a PR, I've created a new one at #524 to track progress/discussion.

@wjakob wjakob mentioned this pull request Nov 22, 2016
@jagerman jagerman mentioned this pull request Aug 5, 2017
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

Successfully merging this pull request may close these issues.

2 participants