Skip to content

bpo-41861: Add NEWS and normalise _sqlite3 Cache/Node type struct naming #23337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Convert :mod:`sqlite3` to use heap types (PEP 384).
Patch by Erlend E. Aasland.
16 changes: 8 additions & 8 deletions Modules/_sqlite/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,17 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
Py_RETURN_NONE;
}

static PyType_Slot pysqlite_NodeType_slots[] = {
static PyType_Slot node_slots[] = {
{Py_tp_dealloc, pysqlite_node_dealloc},
{Py_tp_new, PyType_GenericNew},
{0, NULL},
};

static PyType_Spec pysqlite_NodeType_spec = {
static PyType_Spec node_spec = {
.name = MODULE_NAME ".Node",
.basicsize = sizeof(pysqlite_Node),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.slots = pysqlite_NodeType_slots,
.slots = node_slots,
};
PyTypeObject *pysqlite_NodeType = NULL;

Expand All @@ -280,30 +280,30 @@ static PyMethodDef cache_methods[] = {
{NULL, NULL}
};

static PyType_Slot pysqlite_CacheType_slots[] = {
static PyType_Slot cache_slots[] = {
{Py_tp_dealloc, pysqlite_cache_dealloc},
{Py_tp_methods, cache_methods},
{Py_tp_new, PyType_GenericNew},
{Py_tp_init, pysqlite_cache_init},
{0, NULL},
};

static PyType_Spec pysqlite_CacheType_spec = {
static PyType_Spec cache_spec = {
.name = MODULE_NAME ".Cache",
.basicsize = sizeof(pysqlite_Cache),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.slots = pysqlite_CacheType_slots,
.slots = cache_slots,
};
PyTypeObject *pysqlite_CacheType = NULL;

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) {
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) {
return -1;
}
Expand Down