Skip to content

Commit 05bc1ff

Browse files
stukowskiwjakob
authored andcommitted
Correct function signature of module init function generated PYBIND11_PLUGIN_IMPL macro for Python 2.x (#602)
1 parent 53a338c commit 05bc1ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/pybind11/common.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@
139139
#define PYBIND11_STR_TYPE ::pybind11::bytes
140140
#define PYBIND11_OB_TYPE(ht_type) (ht_type).ob_type
141141
#define PYBIND11_PLUGIN_IMPL(name) \
142-
extern "C" PYBIND11_EXPORT PyObject *init##name()
142+
static PyObject *pybind11_init_wrapper(); \
143+
extern "C" PYBIND11_EXPORT void init##name() { \
144+
(void)pybind11_init_wrapper(); \
145+
} \
146+
PyObject *pybind11_init_wrapper()
143147
#endif
144148

145149
#if PY_VERSION_HEX >= 0x03050000 && PY_VERSION_HEX < 0x03050200

0 commit comments

Comments
 (0)