File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -173,12 +173,15 @@ static void _CallPythonObject(void *mem,
173
173
goto Done ;
174
174
}
175
175
}
176
+
177
+ PyObject * * cnvs = PySequence_Fast_ITEMS (converters );
176
178
for (i = 0 ; i < n_args ; i ++ ) {
177
- /* Note: new reference! */
178
- PyObject * cnv = PySequence_GetItem (converters , i );
179
+ PyObject * cnv = cnvs [i ];
179
180
StgDictObject * dict ;
180
- if (cnv )
181
+ if (cnv ) {
182
+ Py_INCREF (cnv );
181
183
dict = PyType_stgdict (cnv );
184
+ }
182
185
else {
183
186
PrintError ("Getting argument converter %zd\n" , i );
184
187
goto Done ;
@@ -388,10 +391,12 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
388
391
}
389
392
390
393
p -> flags = flags ;
394
+ PyObject * * cnvs = PySequence_Fast_ITEMS (converters );
391
395
for (i = 0 ; i < nArgs ; ++ i ) {
392
- PyObject * cnv = PySequence_GetItem ( converters , i ) ;
396
+ PyObject * cnv = cnvs [ i ] ;
393
397
if (cnv == NULL )
394
398
goto error ;
399
+ Py_INCREF (cnv );
395
400
p -> atypes [i ] = _ctypes_get_ffi_type (cnv );
396
401
Py_DECREF (cnv );
397
402
}
You can’t perform that action at this time.
0 commit comments