diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-12-17 14:52:45 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-17 14:52:45 (GMT) |
commit | 842acaab1376c5c84fd5966bb6070e289880e1ca (patch) | |
tree | f21283245b7e349d05482b89fde8d570b33c53ab /Modules/_asynciomodule.c | |
parent | 4db62e115891425db2a974142a72d8eaaf95eecb (diff) | |
download | cpython-842acaab1376c5c84fd5966bb6070e289880e1ca.zip cpython-842acaab1376c5c84fd5966bb6070e289880e1ca.tar.gz cpython-842acaab1376c5c84fd5966bb6070e289880e1ca.tar.bz2 |
bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175)
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r-- | Modules/_asynciomodule.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 0998cc1..7637cb7 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1113,6 +1113,10 @@ FutureObj_set_blocking(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignored)) if (future_ensure_alive(fut)) { return -1; } + if (val == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } int is_true = PyObject_IsTrue(val); if (is_true < 0) { @@ -1137,6 +1141,10 @@ FutureObj_get_log_traceback(FutureObj *fut, void *Py_UNUSED(ignored)) static int FutureObj_set_log_traceback(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignored)) { + if (val == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } int is_true = PyObject_IsTrue(val); if (is_true < 0) { return -1; @@ -2015,6 +2023,10 @@ TaskObj_get_log_destroy_pending(TaskObj *task, void *Py_UNUSED(ignored)) static int TaskObj_set_log_destroy_pending(TaskObj *task, PyObject *val, void *Py_UNUSED(ignored)) { + if (val == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } int is_true = PyObject_IsTrue(val); if (is_true < 0) { return -1; |