PyType_GenericAlloc is the default allocator: no need to specify

This commit is contained in:
Daniele Varrazzo 2013-03-20 22:27:10 +00:00
parent 8a59e75d62
commit e65392e0d8
19 changed files with 55 additions and 66 deletions

View File

@ -204,7 +204,7 @@ PyTypeObject asisType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
asis_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
asis_new, /*tp_new*/
};

View File

@ -313,7 +313,7 @@ PyTypeObject binaryType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
binary_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
binary_new, /*tp_new*/
};

View File

@ -271,7 +271,7 @@ PyTypeObject pydatetimeType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
pydatetime_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
pydatetime_new, /*tp_new*/
};

View File

@ -268,7 +268,7 @@ PyTypeObject listType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
list_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
list_new, /*tp_new*/
};

View File

@ -204,7 +204,7 @@ PyTypeObject pbooleanType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
pboolean_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
pboolean_new, /*tp_new*/
};

View File

@ -260,7 +260,7 @@ PyTypeObject pdecimalType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
pdecimal_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
pdecimal_new, /*tp_new*/
};

View File

@ -233,7 +233,7 @@ PyTypeObject pfloatType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
pfloat_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
pfloat_new, /*tp_new*/
};

View File

@ -219,7 +219,7 @@ PyTypeObject pintType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
pint_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
pint_new, /*tp_new*/
};

View File

@ -296,7 +296,7 @@ PyTypeObject qstringType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
qstring_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
qstring_new, /*tp_new*/
};

View File

@ -1243,6 +1243,6 @@ PyTypeObject connectionType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
connection_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
connection_new, /*tp_new*/
};

View File

@ -2002,6 +2002,6 @@ PyTypeObject cursorType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
cursor_init, /*tp_init*/
0, /*tp_alloc Will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
cursor_new, /*tp_new*/
};

View File

@ -200,6 +200,6 @@ PyTypeObject diagnosticsType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)diagnostics_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
diagnostics_new, /*tp_new*/
};

View File

@ -282,6 +282,6 @@ PyTypeObject errorType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)error_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
error_new, /*tp_new*/
};

View File

@ -441,7 +441,7 @@ PyTypeObject lobjectType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
lobject_init, /*tp_init*/
0, /*tp_alloc Will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
lobject_new, /*tp_new*/
};

View File

@ -179,6 +179,6 @@ PyTypeObject isqlquoteType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
isqlquote_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
isqlquote_new, /*tp_new*/
};

View File

@ -303,7 +303,7 @@ PyTypeObject notifyType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)notify_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
notify_new, /*tp_new*/
};

View File

@ -768,44 +768,59 @@ INIT_MODULE(_psycopg)(void)
/* initialize all the new types and then the module */
Py_TYPE(&connectionType) = &PyType_Type;
Py_TYPE(&cursorType) = &PyType_Type;
Py_TYPE(&typecastType) = &PyType_Type;
Py_TYPE(&qstringType) = &PyType_Type;
Py_TYPE(&binaryType) = &PyType_Type;
Py_TYPE(&isqlquoteType) = &PyType_Type;
Py_TYPE(&pbooleanType) = &PyType_Type;
Py_TYPE(&pintType) = &PyType_Type;
Py_TYPE(&pfloatType) = &PyType_Type;
Py_TYPE(&pdecimalType) = &PyType_Type;
Py_TYPE(&asisType) = &PyType_Type;
Py_TYPE(&listType) = &PyType_Type;
Py_TYPE(&chunkType) = &PyType_Type;
Py_TYPE(&notifyType) = &PyType_Type;
Py_TYPE(&xidType) = &PyType_Type;
Py_TYPE(&errorType) = &PyType_Type;
Py_TYPE(&diagnosticsType) = &PyType_Type;
if (PyType_Ready(&connectionType) == -1) goto exit;
Py_TYPE(&cursorType) = &PyType_Type;
if (PyType_Ready(&cursorType) == -1) goto exit;
Py_TYPE(&typecastType) = &PyType_Type;
if (PyType_Ready(&typecastType) == -1) goto exit;
Py_TYPE(&qstringType) = &PyType_Type;
if (PyType_Ready(&qstringType) == -1) goto exit;
Py_TYPE(&binaryType) = &PyType_Type;
if (PyType_Ready(&binaryType) == -1) goto exit;
Py_TYPE(&isqlquoteType) = &PyType_Type;
if (PyType_Ready(&isqlquoteType) == -1) goto exit;
Py_TYPE(&pbooleanType) = &PyType_Type;
if (PyType_Ready(&pbooleanType) == -1) goto exit;
Py_TYPE(&pintType) = &PyType_Type;
if (PyType_Ready(&pintType) == -1) goto exit;
Py_TYPE(&pfloatType) = &PyType_Type;
if (PyType_Ready(&pfloatType) == -1) goto exit;
Py_TYPE(&pdecimalType) = &PyType_Type;
if (PyType_Ready(&pdecimalType) == -1) goto exit;
Py_TYPE(&asisType) = &PyType_Type;
if (PyType_Ready(&asisType) == -1) goto exit;
Py_TYPE(&listType) = &PyType_Type;
if (PyType_Ready(&listType) == -1) goto exit;
Py_TYPE(&chunkType) = &PyType_Type;
if (PyType_Ready(&chunkType) == -1) goto exit;
Py_TYPE(&notifyType) = &PyType_Type;
if (PyType_Ready(&notifyType) == -1) goto exit;
Py_TYPE(&xidType) = &PyType_Type;
if (PyType_Ready(&xidType) == -1) goto exit;
Py_TYPE(&errorType) = &PyType_Type;
errorType.tp_base = (PyTypeObject *)PyExc_StandardError;
if (PyType_Ready(&errorType) == -1) goto exit;
Py_TYPE(&diagnosticsType) = &PyType_Type;
if (PyType_Ready(&diagnosticsType) == -1) goto exit;
#ifdef PSYCOPG_EXTENSIONS
Py_TYPE(&lobjectType) = &PyType_Type;
Py_TYPE(&lobjectType) = &PyType_Type;
if (PyType_Ready(&lobjectType) == -1) goto exit;
#endif
@ -813,6 +828,7 @@ INIT_MODULE(_psycopg)(void)
#ifdef HAVE_MXDATETIME
Py_TYPE(&mxdatetimeType) = &PyType_Type;
if (PyType_Ready(&mxdatetimeType) == -1) goto exit;
if (0 != mxDateTime_ImportModuleAndAPI()) {
PyErr_Clear();
@ -921,33 +937,6 @@ INIT_MODULE(_psycopg)(void)
if (0 != psyco_errors_init()) { goto exit; }
psyco_errors_fill(dict);
/* Solve win32 build issue about non-constant initializer element */
cursorType.tp_alloc = PyType_GenericAlloc;
binaryType.tp_alloc = PyType_GenericAlloc;
isqlquoteType.tp_alloc = PyType_GenericAlloc;
pbooleanType.tp_alloc = PyType_GenericAlloc;
pintType.tp_alloc = PyType_GenericAlloc;
pfloatType.tp_alloc = PyType_GenericAlloc;
pdecimalType.tp_alloc = PyType_GenericAlloc;
connectionType.tp_alloc = PyType_GenericAlloc;
asisType.tp_alloc = PyType_GenericAlloc;
qstringType.tp_alloc = PyType_GenericAlloc;
listType.tp_alloc = PyType_GenericAlloc;
chunkType.tp_alloc = PyType_GenericAlloc;
pydatetimeType.tp_alloc = PyType_GenericAlloc;
notifyType.tp_alloc = PyType_GenericAlloc;
xidType.tp_alloc = PyType_GenericAlloc;
errorType.tp_alloc = PyType_GenericAlloc;
diagnosticsType.tp_alloc = PyType_GenericAlloc;
#ifdef PSYCOPG_EXTENSIONS
lobjectType.tp_alloc = PyType_GenericAlloc;
#endif
#ifdef HAVE_MXDATETIME
mxdatetimeType.tp_alloc = PyType_GenericAlloc;
#endif
Dprintf("initpsycopg: module initialization complete");
exit:

View File

@ -508,7 +508,7 @@ PyTypeObject typecastType = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
0, /*tp_methods*/
0, /*tp_methods*/
typecastObject_members, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@ -516,9 +516,9 @@ PyTypeObject typecastType = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_new*/
0, /*tp_init*/
0, /*tp_alloc*/
0, /*tp_new*/
};
static PyObject *

View File

@ -312,7 +312,7 @@ PyTypeObject xidType = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)xid_init, /*tp_init*/
0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/
0, /*tp_alloc*/
xid_new, /*tp_new*/
};