From: Antoine Pitrou Date: Wed, 13 Jul 2011 19:07:49 +0000 (+0200) Subject: Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper... X-Git-Tag: v3.2.2rc1~119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb4ae815b5db6c9339c7c77e1d45e850ed76e497;p=python Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError. --- diff --git a/Misc/NEWS b/Misc/NEWS index 3df8e95387..25c1f3cc67 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Core and Builtins Library ------- +- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a + TextIOWrapper to a huge value, not TypeError. + - Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors if the process has only one pipe. diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 73d83a1c0b..abdbeb765d 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2556,7 +2556,7 @@ textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context) { Py_ssize_t n; CHECK_INITIALIZED_INT(self); - n = PyNumber_AsSsize_t(arg, PyExc_TypeError); + n = PyNumber_AsSsize_t(arg, PyExc_ValueError); if (n == -1 && PyErr_Occurred()) return -1; if (n <= 0) {