diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-31 00:28:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-31 00:28:07 (GMT) |
commit | 0353b4eaaf451ad463ce7eb3074f6b62d332f401 (patch) | |
tree | ee6c8d6f8368ae88711440e187aaa7294f423f6c /Lib/_pyio.py | |
parent | 3f819ca138db6945ee4271bf13e42db9f9b3b1e4 (diff) | |
download | cpython-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 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index b8975ff..e4a8799 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -814,8 +814,7 @@ class _BufferedIOMixin(BufferedIOBase): return self.raw.mode def __getstate__(self): - raise TypeError("can not serialize a '{0}' object" - .format(self.__class__.__name__)) + raise TypeError(f"cannot pickle {self.__class__.__name__!r} object") def __repr__(self): modname = self.__class__.__module__ @@ -1554,7 +1553,7 @@ class FileIO(RawIOBase): self.close() def __getstate__(self): - raise TypeError("cannot serialize '%s' object", self.__class__.__name__) + raise TypeError(f"cannot pickle {self.__class__.__name__!r} object") def __repr__(self): class_name = '%s.%s' % (self.__class__.__module__, |