Changeset: 41da83afd248 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41da83afd248
Modified Files:
sql/backends/monet5/UDF/pyapi3/connection3.c
sql/backends/monet5/UDF/pyapi3/emit3.c
Branch: Jun2020
Log Message:
Use named initializers instead of positional.
Python 3.8 added a new field in the struct which wasn't getting
initialized. Now it is.
diffs (153 lines):
diff --git a/sql/backends/monet5/UDF/pyapi3/connection3.c
b/sql/backends/monet5/UDF/pyapi3/connection3.c
--- a/sql/backends/monet5/UDF/pyapi3/connection3.c
+++ b/sql/backends/monet5/UDF/pyapi3/connection3.c
@@ -124,59 +124,16 @@ PyTypeObject Py_ConnectionType = {
// many compilers throw warnings if you don't use separate braces
// to initialize these separate structs. However, in Python2, they use #defines
// to put this information in, so we have these nice #ifdefs
-#ifdef IS_PY3K
- {{
-#endif
- 1, NULL
-#ifdef IS_PY3K
- }
-#endif
- ,
- 0
-#ifdef IS_PY3K
- }
-#endif
- ,
- "monetdb._connection", sizeof(Py_ConnectionObject), 0, 0, /* tp_dealloc
*/
- 0,
/* tp_print */
- 0,
/* tp_getattr */
- 0,
/* tp_setattr */
- 0,
/* tp_compare */
- 0,
/* tp_repr */
- 0,
/* tp_as_number */
- 0,
/* tp_as_sequence */
- 0,
/* tp_as_mapping */
- (hashfunc)PyObject_HashNotImplemented, /* tp_hash */
- 0,
/* tp_call */
- 0,
/* tp_str */
- 0,
/* tp_getattro */
- 0,
/* tp_setattro */
- 0,
/* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags
*/
- "Connection to MonetDB", /* tp_doc */
- 0,
/* tp_traverse */
- 0,
/* tp_clear */
- 0,
/* tp_richcompare */
- 0,
/* tp_weaklistoffset */
- 0,
/* tp_iter */
- 0,
/* tp_iternext */
- _connectionObject_methods, /* tp_methods */
- 0,
/* tp_members */
- 0,
/* tp_getset */
- 0,
/* tp_base */
- 0,
/* tp_dict */
- 0,
/* tp_descr_get */
- 0,
/* tp_descr_set */
- 0,
/* tp_dictoffset */
- 0,
/* tp_init */
- PyType_GenericAlloc, /* tp_alloc */
- PyType_GenericNew, /* tp_new */
- PyObject_Del, /* tp_free */
- 0, 0, 0, 0, 0, 0, 0, 0
-#ifdef IS_PY3K
- ,
- 0
-#endif
+ .ob_base.ob_base.ob_refcnt = 1,
+ .tp_name = "monetdb._connection",
+ .tp_basicsize = sizeof(Py_ConnectionObject),
+ .tp_hash = (hashfunc)PyObject_HashNotImplemented,
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+ .tp_doc = "Connection to MonetDB",
+ .tp_methods = _connectionObject_methods,
+ .tp_alloc = PyType_GenericAlloc,
+ .tp_new = PyType_GenericNew,
+ .tp_free = PyObject_Del,
};
void _connection_cleanup_result(void *output)
diff --git a/sql/backends/monet5/UDF/pyapi3/emit3.c
b/sql/backends/monet5/UDF/pyapi3/emit3.c
--- a/sql/backends/monet5/UDF/pyapi3/emit3.c
+++ b/sql/backends/monet5/UDF/pyapi3/emit3.c
@@ -395,65 +395,17 @@ static PyMethodDef _emitObject_methods[]
{NULL, NULL, 0, NULL} /* Sentinel */
};
-PyTypeObject PyEmitType = {_PyObject_EXTRA_INIT
-// in python3 they use structs within structs to represent this information,
and
-// many compilers throw warnings if you don't use separate braces
-// to initialize these separate structs. However, in Python2, they use #defines
-// to put this information in, so we have these nice #ifdefs
-#ifdef IS_PY3K
- {{
-#endif
- 1, NULL
-#ifdef IS_PY3K
- }
-#endif
- ,
- 0
-#ifdef IS_PY3K
- }
-#endif
- ,
- "monetdb._emit", sizeof(PyEmitObject), 0,
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- (hashfunc)PyObject_HashNotImplemented, /* tp_hash */
- 0,
/* tp_call */
- 0,
/* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "Value Emitter", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- _emitObject_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- PyType_GenericAlloc, /* tp_alloc */
- PyType_GenericNew, /* tp_new */
- PyObject_Del, /* tp_free */
- 0, 0, 0, 0, 0, 0, 0, 0
-#ifdef IS_PY3K
- ,
- 0
-#endif
+PyTypeObject PyEmitType = {
+ .ob_base.ob_base.ob_refcnt = 1,
+ .tp_name = "monetdb._emit",
+ .tp_basicsize = sizeof(PyEmitObject),
+ .tp_hash = (hashfunc)PyObject_HashNotImplemented,
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+ .tp_doc = "Value Emitter",
+ .tp_methods = _emitObject_methods,
+ .tp_alloc = PyType_GenericAlloc,
+ .tp_new = PyType_GenericNew,
+ .tp_free = PyObject_Del,
};
PyObject *PyEmit_Create(sql_emit_col *cols, size_t ncols)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list