mirror of https://github.com/python/cpython
Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError.
This commit is contained in:
commit
90ce72dd06
|
@ -225,6 +225,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 #12504: Close file handles in a timely manner in packaging.database.
|
||||
This fixes a bug with the remove (uninstall) feature on Windows.
|
||||
|
||||
|
|
|
@ -2618,7 +2618,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) {
|
||||
|
|
Loading…
Reference in New Issue