summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-25 08:37:23 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-25 08:37:23 (GMT)
commit1e7c37514db417a495a1118c0b6d753d88249853 (patch)
tree3af94d770425b0172a1b79056a6989dd8b46455a /Modules
parentd65ab950c10b0a819d99837f83f601c443fa20f0 (diff)
downloadcpython-1e7c37514db417a495a1118c0b6d753d88249853.zip
cpython-1e7c37514db417a495a1118c0b6d753d88249853.tar.gz
cpython-1e7c37514db417a495a1118c0b6d753d88249853.tar.bz2
#2359: add Py3k warning for array.read/array.write.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/arraymodule.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 5655644..a77fd7d 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1255,6 +1255,18 @@ array. Also called as read.");
static PyObject *
+array_fromfile_as_read(arrayobject *self, PyObject *args)
+{
+ if (Py_Py3kWarningFlag &&
+ PyErr_Warn(PyExc_DeprecationWarning,
+ "array.read() not supported in 3.x; "
+ "use array.fromfile()") < 0)
+ return NULL;
+ return array_fromfile(self, args);
+}
+
+
+static PyObject *
array_tofile(arrayobject *self, PyObject *f)
{
FILE *fp;
@@ -1284,6 +1296,18 @@ write.");
static PyObject *
+array_tofile_as_write(arrayobject *self, PyObject *f)
+{
+ if (Py_Py3kWarningFlag &&
+ PyErr_Warn(PyExc_DeprecationWarning,
+ "array.write() not supported in 3.x; "
+ "use array.tofile()") < 0)
+ return NULL;
+ return array_tofile(self, f);
+}
+
+
+static PyObject *
array_fromlist(arrayobject *self, PyObject *list)
{
Py_ssize_t n;
@@ -1522,7 +1546,7 @@ PyMethodDef array_methods[] = {
insert_doc},
{"pop", (PyCFunction)array_pop, METH_VARARGS,
pop_doc},
- {"read", (PyCFunction)array_fromfile, METH_VARARGS,
+ {"read", (PyCFunction)array_fromfile_as_read, METH_VARARGS,
fromfile_doc},
{"__reduce__", (PyCFunction)array_reduce, METH_NOARGS,
array_doc},
@@ -1542,7 +1566,7 @@ PyMethodDef array_methods[] = {
{"tounicode", (PyCFunction)array_tounicode, METH_NOARGS,
tounicode_doc},
#endif
- {"write", (PyCFunction)array_tofile, METH_O,
+ {"write", (PyCFunction)array_tofile_as_write, METH_O,
tofile_doc},
{NULL, NULL} /* sentinel */
};