summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-12-17 14:52:45 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-12-17 14:52:45 (GMT)
commit842acaab1376c5c84fd5966bb6070e289880e1ca (patch)
treef21283245b7e349d05482b89fde8d570b33c53ab /Modules/_io
parent4db62e115891425db2a974142a72d8eaaf95eecb (diff)
downloadcpython-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/_io')
-rw-r--r--Modules/_io/textio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 645d712..14f9488 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -3042,6 +3042,10 @@ textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context)
{
Py_ssize_t n;
CHECK_ATTACHED_INT(self);
+ if (arg == NULL) {
+ PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
+ return -1;
+ }
n = PyNumber_AsSsize_t(arg, PyExc_ValueError);
if (n == -1 && PyErr_Occurred())
return -1;