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

vstinner webhook-mailer at python.org
Tue Nov 17 07:53:15 EST 2020


https://github.com/python/cpython/commit/2ffba2a1027909e1dd697bf8ec2a03fba7618020
commit: 2ffba2a1027909e1dd697bf8ec2a03fba7618020
branch: master
author: Erlend Egeberg Aasland <erlend.aasland at innova.no>
committer: vstinner <vstinner at python.org>
date: 2020年11月17日T13:52:54+01:00
summary:
bpo-41861, _sqlite3 : Add NEWS entry and rename variables (GH-23337)
files:
A Misc/NEWS.d/next/Library/2020-10-01-15-44-52.bpo-41861.YTqJ7z.rst
M Modules/_sqlite/cache.c
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 0000000000000..d34658a254e05
--- /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 0b02be4f0bec9..8cedd07b4596d 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;
 }


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /