]> granicus.if.org Git - python/commitdiff
Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper...
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 13 Jul 2011 19:07:49 +0000 (21:07 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 13 Jul 2011 19:07:49 +0000 (21:07 +0200)
Misc/NEWS
Modules/_io/textio.c

index 3df8e953870feb403120855ec3249e47ebc9cc02..25c1f3cc67e6aa783a3b00033eface5a9968192f 100644 (file)
--- 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.
 
index 73d83a1c0bd184bd10e9c2f294b53ddaf54c359b..abdbeb765d930196f7b1b7090425f6e0a5c90123 100644 (file)
@@ -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) {