This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients alexandre.vassalotti, benjamin.peterson, pitrou, serhiy.storchaka
Date 2019-02-15.08:07:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550218076.22.0.255439546061.issue31829@roundup.psfhosted.org>
In-reply-to
Content
I have simplified the PR. Removed the complex code for detecting pickles written to files in text mode on Windows and for adding optional marks for correct detecting. Currently it does only two things:

* Escapes \r, \0 and \x1a (end-of-file on Windows) when pickle unicode. This allows pickles dumped to a file in binary mode (or on non-Windows, or in Python 3) be correctly loaded from a file opened from a file in text mode on Windows.

Currently, dumping to a file in text mode works most time, except on Windows, when the unicode string ends with \r or contains \x1a (not sure about \0, it was added just for the case). Since the data is only corrupted in special cases, this likely is not tested, and the user code can open files in text (default) mode without noticing a bug, until once a malicious user will provide a bad Unicode string.

* Produces a deprecation warning or even a ValueError in cases when writing to a file in text mode can cause problems. This will help to notice the problem earlier.
History
Date User Action Args
2019-02-15 08:07:56serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, alexandre.vassalotti, benjamin.peterson
2019-02-15 08:07:56serhiy.storchakasetmessageid: <1550218076.22.0.255439546061.issue31829@roundup.psfhosted.org>
2019-02-15 08:07:56serhiy.storchakalinkissue31829 messages
2019-02-15 08:07:56serhiy.storchakacreate