summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-31 00:28:07 (GMT)
committerGitHub <noreply@github.com>2018-10-31 00:28:07 (GMT)
commit0353b4eaaf451ad463ce7eb3074f6b62d332f401 (patch)
treeee6c8d6f8368ae88711440e187aaa7294f423f6c /Modules/_io
parent3f819ca138db6945ee4271bf13e42db9f9b3b1e4 (diff)
downloadcpython-0353b4eaaf451ad463ce7eb3074f6b62d332f401.zip
cpython-0353b4eaaf451ad463ce7eb3074f6b62d332f401.tar.gz
cpython-0353b4eaaf451ad463ce7eb3074f6b62d332f401.tar.bz2
bpo-33138: Change standard error message for non-pickleable and non-copyable types. (GH-6239)
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/bufferedio.c15
-rw-r--r--Modules/_io/fileio.c9
-rw-r--r--Modules/_io/textio.c9
-rw-r--r--Modules/_io/winconsoleio.c9
4 files changed, 0 insertions, 42 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 9d3b446..2eb5262 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -608,16 +608,6 @@ buffered_isatty(buffered *self, PyObject *Py_UNUSED(ignored))
return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_isatty, NULL);
}
-/* Serialization */
-
-static PyObject *
-buffered_getstate(buffered *self, PyObject *Py_UNUSED(ignored))
-{
- PyErr_Format(PyExc_TypeError,
- "cannot serialize '%s' object", Py_TYPE(self)->tp_name);
- return NULL;
-}
-
/* Forward decls */
static PyObject *
_bufferedwriter_flush_unlocked(buffered *);
@@ -2394,7 +2384,6 @@ static PyMethodDef bufferedreader_methods[] = {
{"fileno", (PyCFunction)buffered_fileno, METH_NOARGS},
{"isatty", (PyCFunction)buffered_isatty, METH_NOARGS},
{"_dealloc_warn", (PyCFunction)buffered_dealloc_warn, METH_O},
- {"__getstate__", (PyCFunction)buffered_getstate, METH_NOARGS},
_IO__BUFFERED_READ_METHODDEF
_IO__BUFFERED_PEEK_METHODDEF
@@ -2485,7 +2474,6 @@ static PyMethodDef bufferedwriter_methods[] = {
{"fileno", (PyCFunction)buffered_fileno, METH_NOARGS},
{"isatty", (PyCFunction)buffered_isatty, METH_NOARGS},
{"_dealloc_warn", (PyCFunction)buffered_dealloc_warn, METH_O},
- {"__getstate__", (PyCFunction)buffered_getstate, METH_NOARGS},
_IO_BUFFEREDWRITER_WRITE_METHODDEF
_IO__BUFFERED_TRUNCATE_METHODDEF
@@ -2579,8 +2567,6 @@ static PyMethodDef bufferedrwpair_methods[] = {
{"close", (PyCFunction)bufferedrwpair_close, METH_NOARGS},
{"isatty", (PyCFunction)bufferedrwpair_isatty, METH_NOARGS},
- {"__getstate__", (PyCFunction)buffered_getstate, METH_NOARGS},
-
{NULL, NULL}
};
@@ -2652,7 +2638,6 @@ static PyMethodDef bufferedrandom_methods[] = {
{"fileno", (PyCFunction)buffered_fileno, METH_NOARGS},
{"isatty", (PyCFunction)buffered_isatty, METH_NOARGS},
{"_dealloc_warn", (PyCFunction)buffered_dealloc_warn, METH_O},
- {"__getstate__", (PyCFunction)buffered_getstate, METH_NOARGS},
{"flush", (PyCFunction)buffered_flush, METH_NOARGS},
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 44d51c9..ffcb730 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -1120,14 +1120,6 @@ _io_FileIO_isatty_impl(fileio *self)
return PyBool_FromLong(res);
}
-static PyObject *
-fileio_getstate(fileio *self, PyObject *Py_UNUSED(ignored))
-{
- PyErr_Format(PyExc_TypeError,
- "cannot serialize '%s' object", Py_TYPE(self)->tp_name);
- return NULL;
-}
-
#include "clinic/fileio.c.h"
static PyMethodDef fileio_methods[] = {
@@ -1145,7 +1137,6 @@ static PyMethodDef fileio_methods[] = {
_IO_FILEIO_FILENO_METHODDEF
_IO_FILEIO_ISATTY_METHODDEF
{"_dealloc_warn", (PyCFunction)fileio_dealloc_warn, METH_O, NULL},
- {"__getstate__", (PyCFunction)fileio_getstate, METH_NOARGS, NULL},
{NULL, NULL} /* sentinel */
};
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index a466d3a..3a3667b 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2891,14 +2891,6 @@ _io_TextIOWrapper_isatty_impl(textio *self)
return _PyObject_CallMethodId(self->buffer, &PyId_isatty, NULL);
}
-static PyObject *
-textiowrapper_getstate(textio *self, PyObject *args)
-{
- PyErr_Format(PyExc_TypeError,
- "cannot serialize '%s' object", Py_TYPE(self)->tp_name);
- return NULL;
-}
-
/*[clinic input]
_io.TextIOWrapper.flush
[clinic start generated code]*/
@@ -3132,7 +3124,6 @@ static PyMethodDef textiowrapper_methods[] = {
_IO_TEXTIOWRAPPER_READABLE_METHODDEF
_IO_TEXTIOWRAPPER_WRITABLE_METHODDEF
_IO_TEXTIOWRAPPER_ISATTY_METHODDEF
- {"__getstate__", (PyCFunction)textiowrapper_getstate, METH_NOARGS},
_IO_TEXTIOWRAPPER_SEEK_METHODDEF
_IO_TEXTIOWRAPPER_TELL_METHODDEF
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 13342ec..148255c 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -1060,14 +1060,6 @@ _io__WindowsConsoleIO_isatty_impl(winconsoleio *self)
Py_RETURN_TRUE;
}
-static PyObject *
-winconsoleio_getstate(winconsoleio *self, PyObject *Py_UNUSED(ignored))
-{
- PyErr_Format(PyExc_TypeError,
- "cannot serialize '%s' object", Py_TYPE(self)->tp_name);
- return NULL;
-}
-
#include "clinic/winconsoleio.c.h"
static PyMethodDef winconsoleio_methods[] = {
@@ -1080,7 +1072,6 @@ static PyMethodDef winconsoleio_methods[] = {
_IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
_IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
- {"__getstate__", (PyCFunction)winconsoleio_getstate, METH_NOARGS, NULL},
{NULL, NULL} /* sentinel */
};