Index: Misc/NEWS =================================================================== --- Misc/NEWS (revision 75065) +++ Misc/NEWS (working copy) @@ -379,6 +379,8 @@ Library ------- +- Issue #6790: Removed 'read' and 'write' methods of array.array. + - Issue #6236, #6348: Fix various failures in the `io` module under AIX and other platforms, when using a non-gcc compiler. Patch by egreen. Index: Doc/library/array.rst =================================================================== --- Doc/library/array.rst (revision 75065) +++ Doc/library/array.rst (working copy) @@ -191,18 +191,6 @@ returned. -.. method:: array.read(f, n) - - .. deprecated:: 1.5.1 - Use the :meth:`fromfile` method. - - Read *n* items (as machine values) from the file object *f* and append them to - the end of the array. If less than *n* items are available, :exc:`EOFError` is - raised, but the items that were available are still inserted into the array. - *f* must be a real built-in file object; something else with a :meth:`read` - method won't do. - - .. method:: array.remove(x) Remove the first occurrence of *x* from the array. @@ -237,13 +225,6 @@ obtain a unicode string from an array of some other type. -.. method:: array.write(f) - - .. deprecated:: 1.5.1 - Use the :meth:`tofile` method. - - Write all items (as machine values) to the file object *f*. - When an array object is printed or converted to a string, it is represented as ``array(typecode, initializer)``. The *initializer* is omitted if the array is empty, otherwise it is a string if the *typecode* is ``'c'``, otherwise it is a Index: Modules/arraymodule.c =================================================================== --- Modules/arraymodule.c (revision 75065) +++ Modules/arraymodule.c (working copy) @@ -1241,20 +1241,10 @@ "fromfile(f, n)\n\ \n\ Read n objects from the file object f and append them to the end of the\n\ -array. Also called as read."); +array."); static PyObject * -array_fromfile_as_read(arrayobject *self, PyObject *args) -{ - if (PyErr_WarnPy3k("array.read() not supported in 3.x; " - "use array.fromfile()", 1) < 0) - return NULL; - return array_fromfile(self, args); -} - - -static PyObject * array_tofile(arrayobject *self, PyObject *f) { FILE *fp; @@ -1279,21 +1269,10 @@ PyDoc_STRVAR(tofile_doc, "tofile(f)\n\ \n\ -Write all items (as machine values) to the file object f. Also called as\n\ -write."); +Write all items (as machine values) to the file object f."); static PyObject * -array_tofile_as_write(arrayobject *self, PyObject *f) -{ - if (PyErr_WarnPy3k("array.write() not supported in 3.x; " - "use array.tofile()", 1) < 0) - return NULL; - return array_tofile(self, f); -} - - -static PyObject * array_fromlist(arrayobject *self, PyObject *list) { Py_ssize_t n; @@ -1578,8 +1557,6 @@ insert_doc}, {"pop", (PyCFunction)array_pop, METH_VARARGS, pop_doc}, - {"read", (PyCFunction)array_fromfile_as_read, METH_VARARGS, - fromfile_doc}, {"__reduce__", (PyCFunction)array_reduce, METH_NOARGS, reduce_doc}, {"remove", (PyCFunction)array_remove, METH_O, @@ -1598,8 +1575,6 @@ {"tounicode", (PyCFunction)array_tounicode, METH_NOARGS, tounicode_doc}, #endif - {"write", (PyCFunction)array_tofile_as_write, METH_O, - tofile_doc}, {NULL, NULL} /* sentinel */ }; @@ -2061,13 +2036,11 @@ index() -- return index of first occurrence of an object\n\ insert() -- insert a new item into the array at a provided position\n\ pop() -- remove and return item (default last)\n\ -read() -- DEPRECATED, use fromfile()\n\ remove() -- remove first occurrence of an object\n\ reverse() -- reverse the order of the items in the array\n\ tofile() -- write all items to a file object\n\ tolist() -- return the array converted to an ordinary list\n\ tostring() -- return the array converted to a string\n\ -write() -- DEPRECATED, use tofile()\n\ \n\ Attributes:\n\ \n\