Skip to content

Commit ffa272d

Browse files
author
Hirokazu Yamamoto
committed
Merged revisions 83841,84741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83841 | thomas.heller | 2010-08-09 03:16:20 +0900 | 2 lines Fix issue6869: refcount problem in the _ctypes extension. ........ r84741 | hirokazu.yamamoto | 2010-09-13 01:06:18 +0900 | 2 lines Fixed refcount bug. I placed Py_INCREF in create_comerror() for compatibility with Python2.7. ........
1 parent 1052e39 commit ffa272d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5134,6 +5134,7 @@ create_comerror(void)
51345134
PyComError_Type.tp_base = (PyTypeObject*)PyExc_Exception;
51355135
if (PyType_Ready(&PyComError_Type) < 0)
51365136
return -1;
5137+
Py_INCREF(&PyComError_Type);
51375138
ComError = (PyObject*)&PyComError_Type;
51385139
return 0;
51395140
}
@@ -5326,36 +5327,42 @@ PyInit__ctypes(void)
53265327
Struct_Type.tp_base = &PyCData_Type;
53275328
if (PyType_Ready(&Struct_Type) < 0)
53285329
return NULL;
5330+
Py_INCREF(&Struct_Type);
53295331
PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
53305332

53315333
Py_TYPE(&Union_Type) = &UnionType_Type;
53325334
Union_Type.tp_base = &PyCData_Type;
53335335
if (PyType_Ready(&Union_Type) < 0)
53345336
return NULL;
5337+
Py_INCREF(&Union_Type);
53355338
PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
53365339

53375340
Py_TYPE(&PyCPointer_Type) = &PyCPointerType_Type;
53385341
PyCPointer_Type.tp_base = &PyCData_Type;
53395342
if (PyType_Ready(&PyCPointer_Type) < 0)
53405343
return NULL;
5344+
Py_INCREF(&PyCPointer_Type);
53415345
PyModule_AddObject(m, "_Pointer", (PyObject *)&PyCPointer_Type);
53425346

53435347
Py_TYPE(&PyCArray_Type) = &PyCArrayType_Type;
53445348
PyCArray_Type.tp_base = &PyCData_Type;
53455349
if (PyType_Ready(&PyCArray_Type) < 0)
53465350
return NULL;
5351+
Py_INCREF(&PyCArray_Type);
53475352
PyModule_AddObject(m, "Array", (PyObject *)&PyCArray_Type);
53485353

53495354
Py_TYPE(&Simple_Type) = &PyCSimpleType_Type;
53505355
Simple_Type.tp_base = &PyCData_Type;
53515356
if (PyType_Ready(&Simple_Type) < 0)
53525357
return NULL;
5358+
Py_INCREF(&Simple_Type);
53535359
PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
53545360

53555361
Py_TYPE(&PyCFuncPtr_Type) = &PyCFuncPtrType_Type;
53565362
PyCFuncPtr_Type.tp_base = &PyCData_Type;
53575363
if (PyType_Ready(&PyCFuncPtr_Type) < 0)
53585364
return NULL;
5365+
Py_INCREF(&PyCFuncPtr_Type);
53595366
PyModule_AddObject(m, "CFuncPtr", (PyObject *)&PyCFuncPtr_Type);
53605367

53615368
/*************************************************

0 commit comments

Comments
 (0)