[2.7] bpo-31829: Resolve some portability issues with pickle. by serhiy-storchaka · Pull Request #4067 · python/cpython

@serhiy-storchaka serhiy-storchaka changed the title bpo-31314: Resolve some portability issues with pickle. bpo-31829: Resolve some portability issues with pickle.

Oct 21, 2017

@serhiy-storchaka serhiy-storchaka changed the title bpo-31829: Resolve some portability issues with pickle. [2.7] bpo-31829: Resolve some portability issues with pickle.

Oct 23, 2017
* Document that files should be open in binary mode even for protocol 0 for
  portability.
* Raise a ValueError when pickle with binary protocol to a file opened in
  text mode on Windows.
* Emit a deprecation warning when pickle with binary protocol to a file
  opened in text mode on Unix.
* Emit a deprecation warning in Py3k mode when pickle with protocol 0 to
  a file opened in text mode.
* Fixed unpickling on Unix or in binary mode files writen in text mode on
  Windows. RuntimeWarning now is emitted in cases that was not unpickleable
  before.  Files containing Unicode strings will be unpickled incorrectly.
* `\r`, `\0` and `\x1a` (end-of-file on Windows) now are escaped in
  Unicode strings in protocol 0.

@serhiy-storchaka

@serhiy-storchaka

@serhiy-storchaka

@serhiy-storchaka

@serhiy-storchaka