bpo-38916: array.array: remove fromstring() and tostring() (GH-17487)
array.array: Remove tostring() and fromstring() methods. They were
aliases to tobytes() and frombytes(), deprecated since Python 3.2.
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
index 33f82d4..e1f4b03 100644
--- a/Modules/clinic/arraymodule.c.h
+++ b/Modules/clinic/arraymodule.c.h
@@ -312,54 +312,6 @@
return array_array_tolist_impl(self);
}
-PyDoc_STRVAR(array_array_fromstring__doc__,
-"fromstring($self, buffer, /)\n"
-"--\n"
-"\n"
-"Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).\n"
-"\n"
-"This method is deprecated. Use frombytes instead.");
-
-#define ARRAY_ARRAY_FROMSTRING_METHODDEF \
- {"fromstring", (PyCFunction)array_array_fromstring, METH_O, array_array_fromstring__doc__},
-
-static PyObject *
-array_array_fromstring_impl(arrayobject *self, Py_buffer *buffer);
-
-static PyObject *
-array_array_fromstring(arrayobject *self, PyObject *arg)
-{
- PyObject *return_value = NULL;
- Py_buffer buffer = {NULL, NULL};
-
- if (PyUnicode_Check(arg)) {
- Py_ssize_t len;
- const char *ptr = PyUnicode_AsUTF8AndSize(arg, &len);
- if (ptr == NULL) {
- goto exit;
- }
- PyBuffer_FillInfo(&buffer, arg, (void *)ptr, len, 1, 0);
- }
- else { /* any bytes-like object */
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("fromstring", "argument", "contiguous buffer", arg);
- goto exit;
- }
- }
- return_value = array_array_fromstring_impl(self, &buffer);
-
-exit:
- /* Cleanup for buffer */
- if (buffer.obj) {
- PyBuffer_Release(&buffer);
- }
-
- return return_value;
-}
-
PyDoc_STRVAR(array_array_frombytes__doc__,
"frombytes($self, buffer, /)\n"
"--\n"
@@ -414,26 +366,6 @@
return array_array_tobytes_impl(self);
}
-PyDoc_STRVAR(array_array_tostring__doc__,
-"tostring($self, /)\n"
-"--\n"
-"\n"
-"Convert the array to an array of machine values and return the bytes representation.\n"
-"\n"
-"This method is deprecated. Use tobytes instead.");
-
-#define ARRAY_ARRAY_TOSTRING_METHODDEF \
- {"tostring", (PyCFunction)array_array_tostring, METH_NOARGS, array_array_tostring__doc__},
-
-static PyObject *
-array_array_tostring_impl(arrayobject *self);
-
-static PyObject *
-array_array_tostring(arrayobject *self, PyObject *Py_UNUSED(ignored))
-{
- return array_array_tostring_impl(self);
-}
-
PyDoc_STRVAR(array_array_fromunicode__doc__,
"fromunicode($self, ustr, /)\n"
"--\n"
@@ -599,4 +531,4 @@
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=6aa421571e2c0756 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f649fc0bc9f6b13a input=a9049054013a1b77]*/