summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2010-09-12 16:19:05 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2010-09-12 16:19:05 (GMT)
commitffa272d4d8efaff9ff7147b24c2177212067a29e (patch)
tree633a1be6d2d27e3e06b7563c053434b72aef36d8 /Modules/_ctypes
parent1052e3993bea30b5a2901ce4f480297a8299184c (diff)
downloadcpython-ffa272d4d8efaff9ff7147b24c2177212067a29e.zip
cpython-ffa272d4d8efaff9ff7147b24c2177212067a29e.tar.gz
cpython-ffa272d4d8efaff9ff7147b24c2177212067a29e.tar.bz2
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. ........
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/_ctypes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index c1b3093..5643a65 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -5134,6 +5134,7 @@ create_comerror(void)
PyComError_Type.tp_base = (PyTypeObject*)PyExc_Exception;
if (PyType_Ready(&PyComError_Type) < 0)
return -1;
+ Py_INCREF(&PyComError_Type);
ComError = (PyObject*)&PyComError_Type;
return 0;
}
@@ -5326,36 +5327,42 @@ PyInit__ctypes(void)
Struct_Type.tp_base = &PyCData_Type;
if (PyType_Ready(&Struct_Type) < 0)
return NULL;
+ Py_INCREF(&Struct_Type);
PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
Py_TYPE(&Union_Type) = &UnionType_Type;
Union_Type.tp_base = &PyCData_Type;
if (PyType_Ready(&Union_Type) < 0)
return NULL;
+ Py_INCREF(&Union_Type);
PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
Py_TYPE(&PyCPointer_Type) = &PyCPointerType_Type;
PyCPointer_Type.tp_base = &PyCData_Type;
if (PyType_Ready(&PyCPointer_Type) < 0)
return NULL;
+ Py_INCREF(&PyCPointer_Type);
PyModule_AddObject(m, "_Pointer", (PyObject *)&PyCPointer_Type);
Py_TYPE(&PyCArray_Type) = &PyCArrayType_Type;
PyCArray_Type.tp_base = &PyCData_Type;
if (PyType_Ready(&PyCArray_Type) < 0)
return NULL;
+ Py_INCREF(&PyCArray_Type);
PyModule_AddObject(m, "Array", (PyObject *)&PyCArray_Type);
Py_TYPE(&Simple_Type) = &PyCSimpleType_Type;
Simple_Type.tp_base = &PyCData_Type;
if (PyType_Ready(&Simple_Type) < 0)
return NULL;
+ Py_INCREF(&Simple_Type);
PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
Py_TYPE(&PyCFuncPtr_Type) = &PyCFuncPtrType_Type;
PyCFuncPtr_Type.tp_base = &PyCData_Type;
if (PyType_Ready(&PyCFuncPtr_Type) < 0)
return NULL;
+ Py_INCREF(&PyCFuncPtr_Type);
PyModule_AddObject(m, "CFuncPtr", (PyObject *)&PyCFuncPtr_Type);
/*************************************************