summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2019-10-23 14:04:29 +0300
committerMax Romanov <max.romanov@nginx.com>2019-10-23 14:04:29 +0300
commitad518ae6c491308351eaa0d4065c09870d56f9ae (patch)
treeb3d7586df83dc2a789361a0147f9b96eed2a0159
parent23b94fde832dcccb801be9acde1471c3fca3a4e9 (diff)
downloadunit-ad518ae6c491308351eaa0d4065c09870d56f9ae.tar.gz
unit-ad518ae6c491308351eaa0d4065c09870d56f9ae.tar.bz2
Python: fixing Python 3.8 build with clang.
Python 3.8 has 'tp_print' field in PyTypeObject struct. This field is attributed as deprecated. So, clang generates warning (which is turned to error) as a result of initializing this field. From the other hand, it is impossible to omit this field in positional initialization. The solution is to use designated initializer. Silencing usage message during configure python. This is related to #331 issue on GitHub.
-rw-r--r--auto/modules/python2
-rw-r--r--src/nxt_python_wsgi.c60
2 files changed, 8 insertions, 54 deletions
diff --git a/auto/modules/python b/auto/modules/python
index ecf8802a..6c8198f5 100644
--- a/auto/modules/python
+++ b/auto/modules/python
@@ -64,7 +64,7 @@ nxt_found=no
if /bin/sh -c "$NXT_PYTHON_CONFIG --prefix" >> $NXT_AUTOCONF_ERR 2>&1; then
- if ${NXT_PYTHON_CONFIG} --embed 2>/dev/null; then
+ if ${NXT_PYTHON_CONFIG} --embed >/dev/null 2>&1; then
NXT_PYTHON_CONFIG="${NXT_PYTHON_CONFIG} --embed"
fi
diff --git a/src/nxt_python_wsgi.c b/src/nxt_python_wsgi.c
index 977c2998..0d647e40 100644
--- a/src/nxt_python_wsgi.c
+++ b/src/nxt_python_wsgi.c
@@ -130,59 +130,13 @@ static PyMethodDef nxt_py_input_methods[] = {
static PyTypeObject nxt_py_input_type = {
PyVarObject_HEAD_INIT(NULL, 0)
- "unit._input", /* tp_name */
- (int) sizeof(nxt_py_input_t), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor) nxt_py_input_dealloc, /* 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 */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "unit input object.", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- nxt_py_input_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 */
- 0, /* tp_alloc */
- 0, /* tp_new */
- 0, /* tp_free */
- 0, /* tp_is_gc */
- 0, /* tp_bases */
- 0, /* tp_mro - method resolution order */
- 0, /* tp_cache */
- 0, /* tp_subclasses */
- 0, /* tp_weaklist */
- 0, /* tp_del */
- 0, /* tp_version_tag */
-#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 3
- 0, /* tp_finalize */
-#endif
-#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8
- 0, /* tp_vectorcall */
- 0, /* tp_print */
-#endif
+
+ .tp_name = "unit._input",
+ .tp_basicsize = sizeof(nxt_py_input_t),
+ .tp_dealloc = (destructor) nxt_py_input_dealloc,
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+ .tp_doc = "unit input object.",
+ .tp_methods = nxt_py_input_methods,
};