aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_asynciomodule.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 150ca198d27..b8a88e61d4a 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -306,6 +306,8 @@ future_add_done_callback(FutureObj *fut, PyObject *arg)
static PyObject *
future_cancel(FutureObj *fut)
{
+ fut->fut_log_tb = 0;
+
if (fut->fut_state != STATE_PENDING) {
Py_RETURN_FALSE;
}
@@ -639,6 +641,17 @@ FutureObj_get_log_traceback(FutureObj *fut)
}
}
+static int
+FutureObj_set_log_traceback(FutureObj *fut, PyObject *val)
+{
+ int is_true = PyObject_IsTrue(val);
+ if (is_true < 0) {
+ return -1;
+ }
+ fut->fut_log_tb = is_true;
+ return 0;
+}
+
static PyObject *
FutureObj_get_loop(FutureObj *fut)
{
@@ -883,7 +896,8 @@ static PyMethodDef FutureType_methods[] = {
{"_callbacks", (getter)FutureObj_get_callbacks, NULL, NULL}, \
{"_result", (getter)FutureObj_get_result, NULL, NULL}, \
{"_exception", (getter)FutureObj_get_exception, NULL, NULL}, \
- {"_log_traceback", (getter)FutureObj_get_log_traceback, NULL, NULL}, \
+ {"_log_traceback", (getter)FutureObj_get_log_traceback, \
+ (setter)FutureObj_set_log_traceback, NULL}, \
{"_source_traceback", (getter)FutureObj_get_source_traceback, NULL, NULL},
static PyGetSetDef FutureType_getsetlist[] = {
@@ -1569,6 +1583,8 @@ static PyObject *
_asyncio_Task_cancel_impl(TaskObj *self)
/*[clinic end generated code: output=6bfc0479da9d5757 input=13f9bf496695cb52]*/
{
+ self->task_log_tb = 0;
+
if (self->task_state != STATE_PENDING) {
Py_RETURN_FALSE;
}