[Python-checkins] cpython (3.2): Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a

antoine.pitrou python-checkins at python.org
Wed Jul 13 21:10:05 CEST 2011


http://hg.python.org/cpython/rev/2b97f5220940
changeset:   71309:2b97f5220940
branch:      3.2
parent:      71307:4105b0653bc3
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Jul 13 21:07:49 2011 +0200
summary:
  Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError.

files:
  Misc/NEWS            |  3 +++
  Modules/_io/textio.c |  2 +-
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,9 @@
 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
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2556,7 +2556,7 @@
 {
     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) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list