commit c1653a525489ae84ca962f7b512506b53acac43a
parent 019006620dde61e55bb3f51122cd3550ebffb1a6
Author: Joris Vink <joris@coders.se>
Date: Mon, 16 Sep 2019 20:33:14 +0200
hide kore.coroname() behind PYTHON_CORO_TRACE.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/kore/python_methods.h b/include/kore/python_methods.h
@@ -21,7 +21,9 @@ struct python_coro {
u_int64_t id;
int state;
PyObject *obj;
+#if defined(PYTHON_CORO_TRACE)
char *name;
+#endif
PyObject *result;
struct pysocket_op *sockop;
struct pygather_op *gatherop;
diff --git a/src/python.c b/src/python.c
@@ -333,7 +333,9 @@ kore_python_coro_delete(void *obj)
else
TAILQ_REMOVE(&coro_suspended, coro, list);
+#if defined(PYTHON_CORO_TRACE)
kore_free(coro->name);
+#endif
Py_XDECREF(coro->result);
kore_pool_put(&coro_pool, coro);
@@ -555,7 +557,9 @@ python_coro_create(PyObject *obj, struct http_request *req)
coro = kore_pool_get(&coro_pool);
coro_count++;
+#if defined(PYTHON_CORO_TRACE)
coro->name = NULL;
+#endif
coro->result = NULL;
coro->sockop = NULL;
coro->gatherop = NULL;
@@ -1528,6 +1532,7 @@ python_kore_shutdown(PyObject *self, PyObject *args)
static PyObject *
python_kore_coroname(PyObject *self, PyObject *args)
{
+#if defined(PYTHON_CORO_TRACE)
const char *name;
if (coro_running == NULL) {
@@ -1541,7 +1546,7 @@ python_kore_coroname(PyObject *self, PyObject *args)
kore_free(coro_running->name);
coro_running->name = kore_strdup(name);
-
+#endif
Py_RETURN_NONE;
}