@@ -85,25 +85,34 @@ result_init(getdns_ResultObject *self, PyObject *args, PyObject *keywds)
85
85
#else
86
86
self -> answer_type = PyInt_FromLong ((long )answer_type );
87
87
#endif
88
- if ((canonical_name = get_canonical_name (result_dict )) == 0 )
88
+ if ((canonical_name = get_canonical_name (result_dict )) == 0 ) {
89
89
self -> canonical_name = Py_None ;
90
- else
90
+ Py_INCREF (Py_None );
91
+ } else {
91
92
#if PY_MAJOR_VERSION >= 3
92
93
self -> canonical_name = PyUnicode_FromString (canonical_name );
93
94
#else
94
95
self -> canonical_name = PyString_FromString (canonical_name );
95
96
#endif
97
+ }
96
98
if ((self -> just_address_answers = get_just_address_answers (result_dict )) == NULL ) {
97
99
self -> just_address_answers = Py_None ;
100
+ Py_INCREF (Py_None );
98
101
}
99
- if ((self -> validation_chain = get_validation_chain (result_dict )) == NULL )
102
+ if ((self -> validation_chain = get_validation_chain (result_dict )) == NULL ) {
100
103
self -> validation_chain = Py_None ;
104
+ Py_INCREF (Py_None );
105
+ }
101
106
#if GETDNS_NUMERIC_VERSION < 0x00090000
102
- if ((self -> call_debugging = get_call_debugging (result_dict )) == NULL )
107
+ if ((self -> call_debugging = get_call_debugging (result_dict )) == NULL ) {
103
108
self -> call_debugging = Py_None ;
109
+ Py_INCREF (Py_None );
110
+ }
104
111
#else
105
- if ((self -> call_reporting = get_call_reporting (result_dict )) == NULL )
112
+ if ((self -> call_reporting = get_call_reporting (result_dict )) == NULL ) {
106
113
self -> call_reporting = Py_None ;
114
+ Py_INCREF (Py_None );
115
+ }
107
116
#endif
108
117
return 0 ;
109
118
}
@@ -117,16 +126,25 @@ result_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
117
126
self = (getdns_ResultObject * )type -> tp_alloc (type , 0 );
118
127
if (self != NULL ) {
119
128
self -> just_address_answers = Py_None ;
129
+ Py_INCREF (Py_None );
120
130
self -> answer_type = Py_None ;
131
+ Py_INCREF (Py_None );
121
132
self -> status = Py_None ;
133
+ Py_INCREF (Py_None );
122
134
self -> replies_tree = Py_None ;
135
+ Py_INCREF (Py_None );
123
136
self -> canonical_name = Py_None ;
137
+ Py_INCREF (Py_None );
124
138
self -> replies_full = Py_None ;
139
+ Py_INCREF (Py_None );
125
140
self -> validation_chain = Py_None ;
141
+ Py_INCREF (Py_None );
126
142
#if GETDNS_NUMERIC_VERSION < 0x00090000
127
143
self -> call_debugging = Py_None ;
144
+ Py_INCREF (Py_None );
128
145
#else
129
146
self -> call_reporting = Py_None ;
147
+ Py_INCREF (Py_None );
130
148
#endif
131
149
}
132
150
return (PyObject * )self ;
0 commit comments