Skip to content

Commit f5cb1f0

Browse files
committed
Fixed up Result() resource release
1 parent 4eb3a4c commit f5cb1f0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

result.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include "pygetdns.h"
1111

1212

13+
#if !defined(Py_TYPE)
14+
#define Py_TYPE(ob) (((PyObject *)(ob))->ob_type)
15+
#endif
16+
1317
int
1418
result_init(getdns_ResultObject *self, PyObject *args, PyObject *keywds)
1519
{
@@ -103,7 +107,9 @@ result_dealloc(getdns_ResultObject *self)
103107
Py_XDECREF(self->replies_tree);
104108
Py_XDECREF(self->replies_full);
105109
Py_XDECREF(self->canonical_name);
106-
#if PY_MAJOR_VERSION < 3
110+
#if PY_MAJOR_VERSION >= 3
111+
Py_TYPE(self)->tp_free((PyObject *)self);
112+
#else
107113
self->ob_type->tp_free((PyObject *)self);
108114
#endif
109115
}

0 commit comments

Comments
 (0)