gh-50644: Forbid pickling of codecs streams#109180
gh-50644: Forbid pickling of codecs streams#109180serhiy-storchaka merged 2 commits intopython:mainfrom
Conversation
Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, stream pickling produced invalid data, which attempts to read resulted in a RecursionError, as well as attempts to create a copy of the stream.
malemburg
left a comment
There was a problem hiding this comment.
Other than the minor nit with the news entry this LGTM. Thanks, Serhiy.
| Attempts to pickle or create a shallow or deep copy of :mod:`codecs` streams | ||
| now raise a TypeError. Previously, stream pickling produced invalid data, | ||
| which attempts to read resulted in a RecursionError, as well as attempts to | ||
| create a copy of the stream. |
There was a problem hiding this comment.
Better wording: Previously, unpickled or copied streams could produce invalid data and attempts to read from them resulted in a RecursionError.
There was a problem hiding this comment.
Sorry, maybe my English is so bad that it was misunderstood by you. The problem is:
- Attempt to pickle a stream finished successfully. But the result is incorrect, and attempt to unpickle it fails with RecursionError.
- Attempt to copy a stream fails with RecursionError.
So there is no unpickled or copied stream. You cannot unpickle or copy.
How to say this in one sentence?
There was a problem hiding this comment.
How about this:
Previously, both operations were possible, but produced wrong results and eventually failed with a RecursionError.
There was a problem hiding this comment.
Unfortunately, it is still not completely technically correct, because copying was not possible, and pickling caused a failure on other end. How about this:
Previously, pickling produced wrong results that eventually caused unpickling to fail with a RecursionError. Copying failed with a RecursionError.
or this:
Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError.
There was a problem hiding this comment.
Both are great. Sorry for the extra rounds 🙂
There was a problem hiding this comment.
Thank you. I always grateful for corrections.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
|
GH-109231 is a backport of this pull request to the 3.12 branch. |
Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError. (cherry picked from commit d6892c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-109232 is a backport of this pull request to the 3.11 branch. |
Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError. (cherry picked from commit d6892c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…9232) Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError. (cherry picked from commit d6892c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
gh-50644: Forbid pickling of codecs streams (GH-109180) Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError. (cherry picked from commit d6892c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError.
Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError.