From fb1da3b12bfc427fdd5e842b1ba62435ea93dc13 Mon Sep 17 00:00:00 2001 From: "Stuart D. Gathman" Date: Mon, 17 Oct 2016 19:15:07 -0400 Subject: [PATCH] Call PyType_Ready --- milter.patch | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/milter.patch b/milter.patch index aa6f189..7ffda9d 100644 --- a/milter.patch +++ b/milter.patch @@ -1,5 +1,5 @@ diff --git a/miltermodule.c b/miltermodule.c -index aa10a08..af9a144 100644 +index aa10a08..b085bad 100644 --- a/miltermodule.c +++ b/miltermodule.c @@ -343,7 +343,7 @@ static struct MilterCallback { @@ -94,8 +94,9 @@ index aa10a08..af9a144 100644 static PyTypeObject milter_ContextType = { - PyObject_HEAD_INIT(&PyType_Type) - 0, +- "milterContext", + PyVarObject_HEAD_INIT(&PyType_Type,0) - "milterContext", ++ "milter.Context", sizeof(milter_ContextObject), 0, milter_Context_dealloc, /* tp_dealloc */ @@ -119,7 +120,7 @@ index aa10a08..af9a144 100644 }; static const char milter_documentation[] = -@@ -1634,17 +1635,27 @@ Libmilter is currently marked FFR, and needs to be explicitly installed.\n\ +@@ -1634,17 +1635,31 @@ Libmilter is currently marked FFR, and needs to be explicitly installed.\n\ See /libmilter/README for details on setting it up.\n"; static void setitem(PyObject *d,const char *name,long val) { @@ -148,11 +149,15 @@ index aa10a08..af9a144 100644 - m = Py_InitModule4("milter", milter_methods, milter_documentation, - (PyObject*)NULL, PYTHON_API_VERSION); ++ if (PyType_Ready(&milter_ContextType) < 0) ++ return NULL; ++ + m = PyModule_Create(&moduledef); ++ if (m == NULL) return NULL; d = PyModule_GetDict(m); MilterError = PyErr_NewException("milter.error", NULL, NULL); PyDict_SetItemString(d,"error", MilterError); -@@ -1710,4 +1721,5 @@ initmilter(void) { +@@ -1710,4 +1725,5 @@ initmilter(void) { setitem(d,"DISCARD", SMFIS_DISCARD); setitem(d,"ACCEPT", SMFIS_ACCEPT); setitem(d,"TEMPFAIL", SMFIS_TEMPFAIL);