From 2ffba2a1027909e1dd697bf8ec2a03fba7618020 Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Tue, 17 Nov 2020 13:52:54 +0100 Subject: [PATCH] bpo-41861, _sqlite3 : Add NEWS entry and rename variables (GH-23337) --- .../2020-10-01-15-44-52.bpo-41861.YTqJ7z.rst | 2 ++ Modules/_sqlite/cache.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2020-10-01-15-44-52.bpo-41861.YTqJ7z.rst diff --git a/Misc/NEWS.d/next/Library/2020-10-01-15-44-52.bpo-41861.YTqJ7z.rst b/Misc/NEWS.d/next/Library/2020-10-01-15-44-52.bpo-41861.YTqJ7z.rst new file mode 100644 index 00000000000..d34658a254e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-10-01-15-44-52.bpo-41861.YTqJ7z.rst @@ -0,0 +1,2 @@ +Convert :mod:`sqlite3` to use heap types (PEP 384). +Patch by Erlend E. Aasland. diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c index 0b02be4f0be..8cedd07b459 100644 --- a/Modules/_sqlite/cache.c +++ b/Modules/_sqlite/cache.c @@ -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; @@ -280,7 +280,7 @@ 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}, @@ -288,22 +288,22 @@ static PyType_Slot pysqlite_CacheType_slots[] = { {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; }