diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index be30b866e20..daaf95cb665 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -25,6 +25,7 @@ #include #include "includes.h" +#include "python/py3compat.h" #include "smbd/smbd.h" #include "libcli/util/pyerrors.h" #include "librpc/rpc/pyrpc_util.h" @@ -739,13 +740,19 @@ static PyMethodDef py_smbd_methods[] = { }; void initsmbd(void); -void initsmbd(void) + +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + .m_name = "smbd", + .m_doc = "Python bindings for the smbd file server.", + .m_size = -1, + .m_methods = py_smbd_methods, +}; + +MODULE_INIT_FUNC(smbd) { - PyObject *m; - - m = Py_InitModule3("smbd", py_smbd_methods, - "Python bindings for the smbd file server."); - if (m == NULL) - return; + PyObject *m = NULL; + m = PyModule_Create(&moduledef); + return m; } diff --git a/source3/wscript_build b/source3/wscript_build index 254738e69ea..f0eb23cc3f7 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1296,7 +1296,9 @@ bld.SAMBA3_BINARY('vlp', ''', install=False) -bld.SAMBA3_PYTHON('pysmbd', + +for env in bld.gen_python_environments(): + bld.SAMBA3_PYTHON('pysmbd', source='smbd/pysmbd.c', deps='smbd_base pyrpc_util pytalloc-util', realname='samba/samba3/smbd.so'