Skip to content

Correct function signature for Python 2.x module init function #602

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
Jan 13, 2017
Merged

Correct function signature for Python 2.x module init function #602

merged 1 commit into from
Jan 13, 2017

Conversation

stukowski
Copy link
Contributor

The PYBIND11_PLUGIN_IMPL macro defines an initXXX() function with a wrong signature. Under Python 2.x it should have return type void instead of PyObject*, see

https://docs.python.org/2/extending/extending.html#the-module-s-method-table-and-initialization-function
and
https://docs.python.org/2.7/c-api/import.html#c.PyImport_AppendInittab

This pull request corrects this by wrapping the existing init function with PyObject* return type in a function with void return type.

@wjakob
Copy link
Member

wjakob commented Jan 13, 2017

Nice catch, thanks!

@wjakob wjakob merged commit 05bc1ff into pybind:master Jan 13, 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