bpo-41861, _sqlite3 : Add NEWS entry and rename variables (GH-23337)

This commit is contained in:
Erlend Egeberg Aasland 2020-11-17 13:52:54 +01:00 committed by GitHub
parent f03d318ca4
commit 2ffba2a102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -0,0 +1,2 @@
Convert :mod:`sqlite3` to use heap types (PEP 384).
Patch by Erlend E. Aasland.

View File

@ -258,17 +258,17 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
Py_RETURN_NONE; Py_RETURN_NONE;
} }
static PyType_Slot pysqlite_NodeType_slots[] = { static PyType_Slot node_slots[] = {
{Py_tp_dealloc, pysqlite_node_dealloc}, {Py_tp_dealloc, pysqlite_node_dealloc},
{Py_tp_new, PyType_GenericNew}, {Py_tp_new, PyType_GenericNew},
{0, NULL}, {0, NULL},
}; };
static PyType_Spec pysqlite_NodeType_spec = { static PyType_Spec node_spec = {
.name = MODULE_NAME ".Node", .name = MODULE_NAME ".Node",
.basicsize = sizeof(pysqlite_Node), .basicsize = sizeof(pysqlite_Node),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.slots = pysqlite_NodeType_slots, .slots = node_slots,
}; };
PyTypeObject *pysqlite_NodeType = NULL; PyTypeObject *pysqlite_NodeType = NULL;
@ -280,7 +280,7 @@ static PyMethodDef cache_methods[] = {
{NULL, NULL} {NULL, NULL}
}; };
static PyType_Slot pysqlite_CacheType_slots[] = { static PyType_Slot cache_slots[] = {
{Py_tp_dealloc, pysqlite_cache_dealloc}, {Py_tp_dealloc, pysqlite_cache_dealloc},
{Py_tp_methods, cache_methods}, {Py_tp_methods, cache_methods},
{Py_tp_new, PyType_GenericNew}, {Py_tp_new, PyType_GenericNew},
@ -288,22 +288,22 @@ static PyType_Slot pysqlite_CacheType_slots[] = {
{0, NULL}, {0, NULL},
}; };
static PyType_Spec pysqlite_CacheType_spec = { static PyType_Spec cache_spec = {
.name = MODULE_NAME ".Cache", .name = MODULE_NAME ".Cache",
.basicsize = sizeof(pysqlite_Cache), .basicsize = sizeof(pysqlite_Cache),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.slots = pysqlite_CacheType_slots, .slots = cache_slots,
}; };
PyTypeObject *pysqlite_CacheType = NULL; PyTypeObject *pysqlite_CacheType = NULL;
extern int pysqlite_cache_setup_types(PyObject *mod) extern int pysqlite_cache_setup_types(PyObject *mod)
{ {
pysqlite_NodeType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &pysqlite_NodeType_spec, NULL); pysqlite_NodeType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &node_spec, NULL);
if (pysqlite_NodeType == NULL) { if (pysqlite_NodeType == NULL) {
return -1; return -1;
} }
pysqlite_CacheType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &pysqlite_CacheType_spec, NULL); pysqlite_CacheType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &cache_spec, NULL);
if (pysqlite_CacheType == NULL) { if (pysqlite_CacheType == NULL) {
return -1; return -1;
} }