Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BUILDDIR = build
DISTDIR = dist

# Gah
SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; print "lib.%s-%s" % (distutils.util.get_platform(), sys.version[0:3])')
SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; print("lib.%s-%s" % (distutils.util.get_platform(), sys.version[0:3]))')
BUILDDIR := $(BUILDDIR)/$(SUBBUILDDIR)

COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \
Expand Down
14 changes: 14 additions & 0 deletions src/passfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,26 @@ static PyMethodDef methods[] = {
{NULL, NULL, 0, NULL}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef passfd_module = {
PyModuleDef_HEAD_INIT,
"_passfd",
"Functions to pass file descriptors across UNIX domain sockets",
-1,
methods
};

PyMODINIT_FUNC PyInit__passfd(void) {
return PyModule_Create(&passfd_module);
}
#else
PyMODINIT_FUNC init_passfd(void) {
PyObject *m;
m = Py_InitModule("_passfd", methods);
if (m == NULL)
return;
}
#endif /* PY_MAJOR_VERSION >= 3 */

/* Size of the cmsg including one file descriptor */
#define CMSG_SIZE CMSG_SPACE(sizeof(int))
Expand Down