@@ -203,8 +203,6 @@ int PyXmlSec_EncModule_Init(PyObject* package);
203203// templates management
204204int PyXmlSec_TemplateModule_Init (PyObject * package );
205205
206- #ifdef PY3K
207-
208206static int PyXmlSec_PyClear (PyObject * self ) {
209207 PyXmlSec_Free (free_mode );
210208 return 0 ;
@@ -225,54 +223,12 @@ static PyModuleDef PyXmlSecModule = {
225223
226224#define PYENTRY_FUNC_NAME JOIN(PyInit_, MODULE_NAME)
227225#define PY_MOD_RETURN (m ) return m
228- #else // PY3K
229- #define PYENTRY_FUNC_NAME JOIN(init, MODULE_NAME)
230- #define PY_MOD_RETURN (m ) return
231-
232- static void PyXmlSec_PyModuleGuard__del__ (PyObject * self )
233- {
234- PyXmlSec_Free (free_mode );
235- Py_TYPE (self )-> tp_free (self );
236- }
237-
238- // we need guard to free resources on module unload
239- typedef struct {
240- PyObject_HEAD
241- } PyXmlSec_PyModuleGuard ;
242-
243- static PyTypeObject PyXmlSec_PyModuleGuardType = {
244- PyVarObject_HEAD_INIT (NULL , 0 )
245- STRINGIFY (MODULE_NAME ) "__Guard" , /* tp_name */
246- sizeof (PyXmlSec_PyModuleGuard ), /* tp_basicsize */
247- 0 , /* tp_itemsize */
248- PyXmlSec_PyModuleGuard__del__ , /* tp_dealloc */
249- 0 , /* tp_print */
250- 0 , /* tp_getattr */
251- 0 , /* tp_setattr */
252- 0 , /* tp_reserved */
253- 0 , /* tp_repr */
254- 0 , /* tp_as_number */
255- 0 , /* tp_as_sequence */
256- 0 , /* tp_as_mapping */
257- 0 , /* tp_hash */
258- 0 , /* tp_call */
259- 0 , /* tp_str */
260- 0 , /* tp_getattro */
261- 0 , /* tp_setattro */
262- 0 , /* tp_as_buffer */
263- Py_TPFLAGS_DEFAULT , /* tp_flags */
264- };
265- #endif // PY3K
266226
267227PyMODINIT_FUNC
268228PYENTRY_FUNC_NAME (void )
269229{
270230 PyObject * module = NULL ;
271- #ifdef PY3K
272231 module = PyModule_Create (& PyXmlSecModule );
273- #else
274- module = Py_InitModule3 (STRINGIFY (MODULE_NAME ), PyXmlSec_MainMethods , MODULE_DOC );
275- #endif
276232 if (!module ) {
277233 PY_MOD_RETURN (NULL ); /* this really should never happen */
278234 }
@@ -294,13 +250,6 @@ PYENTRY_FUNC_NAME(void)
294250 if (PyXmlSec_EncModule_Init (module ) < 0 ) goto ON_FAIL ;
295251 if (PyXmlSec_TemplateModule_Init (module ) < 0 ) goto ON_FAIL ;
296252
297- #ifndef PY3K
298- if (PyType_Ready (& PyXmlSec_PyModuleGuardType ) < 0 ) goto ON_FAIL ;
299- PYXMLSEC_DEBUGF ("%p" , & PyXmlSec_PyModuleGuardType );
300- // added guard to free resources on module unload, this should be called after last
301- if (PyModule_AddObject (module , "__guard" , _PyObject_New (& PyXmlSec_PyModuleGuardType )) < 0 ) goto ON_FAIL ;
302- #endif
303-
304253 PY_MOD_RETURN (module );
305254ON_FAIL :
306255 PY_MOD_RETURN (NULL );
0 commit comments