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.
Created on 2020年06月20日 13:17 by corona10, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 21002 | merged | corona10, 2020年06月20日 13:47 | |
| PR 21030 | merged | corona10, 2020年06月21日 09:58 | |
| PR 22189 | closed | corona10, 2020年09月10日 14:48 | |
| PR 22870 | merged | serhiy.storchaka, 2020年10月21日 20:47 | |
| PR 22963 | merged | serhiy.storchaka, 2020年10月25日 08:10 | |
| Messages (10) | |||
|---|---|---|---|
| msg371937 - (view) | Author: Dong-hee Na (corona10) * (Python committer) | Date: 2020年06月20日 13:17 | |
See https://bugs.python.org/issue40077#msg371813 We noticed that heap type has different behavior about serialization/deserialization. Basically it can occur the regression issues. Two things needed. 1. opt out serialization/deserialization for converted modules. 2. Add unit tests to check whether their serialization is blocked. 3. If the module is already ported to 3.9 backport patch is needed. Long term - Add the object.reduce() and/or update pickle can be smarter |
|||
| msg371992 - (view) | Author: Dong-hee Na (corona10) * (Python committer) | Date: 2020年06月21日 09:45 | |
New changeset 6989af0bc7ea1e9a1acea16794e6f723d7b44110 by Dong-hee Na in branch 'master': bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002) https://github.com/python/cpython/commit/6989af0bc7ea1e9a1acea16794e6f723d7b44110 |
|||
| msg371993 - (view) | Author: Dong-hee Na (corona10) * (Python committer) | Date: 2020年06月21日 10:33 | |
New changeset 814b07bf814a804f60b897d18f1dbb5578b2c7fd by Dong-hee Na in branch '3.9': [3.9] bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002). (GH-21030) https://github.com/python/cpython/commit/814b07bf814a804f60b897d18f1dbb5578b2c7fd |
|||
| msg376951 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2020年09月15日 20:10 | |
There are other heap types implemented in C in the stdlib and third-party libraries for which pickling with protocols 0 and 1 works incorrectly. It would be better to fix copyreg._reduce_ex() instead of disabling pickling for these types one by one. From PEP 307: > Let D be the class on the object to be pickled. First, find the nearest base class that is implemented in C (either as a built-in type or as a type defined by an extension class). Call this base class B, and the class of the object to be pickled D. Unless B is the class 'object', instances of class B must be picklable, either by having built-in support (as defined in the above three bullet points), or by having a non-default __reduce__ implementation. B must not be the same class as D (if it were, it would mean that D is not implemented in Python). The problem is with determining which class is implemented in C. The current code implies that heap types are implemented in Python, and static types are implemented in C. It is not always true, because some heap types can be implemented in C. |
|||
| msg379214 - (view) | Author: Dong-hee Na (corona10) * (Python committer) | Date: 2020年10月21日 15:42 | |
> It would be better to fix copyreg._reduce_ex() instead of disabling pickling for these types one by one I agree :) |
|||
| msg379223 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2020年10月21日 17:11 | |
At some point, pickle protocols 0 and 1 should be deprecated and slated for removal. Protocol 2 is 17 years ago already, and protocol 3 has become the default in Python 3. That would probably be a better use of contributor time than trying to make heap types compatible with those obsolete protocols. |
|||
| msg379251 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2020年10月21日 20:52 | |
I came to the same conclusion after trying to fix it. But we cannot just do it now. We have to fix bugs in Python 3.9 and support protocols 0 and 1 for some deprecation period. Also protocols 0 and 1 are used in some third-party implementations for other programming languages, so they can be used for interoperability with other languages. The proposed patch adds additional check. It uses the fact that the __new__ attribute for classes implemented in C is a bultin function with __self__ pointing to this class (it is created in tp_new_wrapper()). |
|||
| msg379532 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2020年10月24日 18:14 | |
New changeset 8cd1dbae32d9303caac3a473d3332f17bc98c921 by Serhiy Storchaka in branch 'master': bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 (GH-22870) https://github.com/python/cpython/commit/8cd1dbae32d9303caac3a473d3332f17bc98c921 |
|||
| msg379585 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2020年10月25日 15:56 | |
New changeset 0aaecb30483e98fc29c1f4253967d05da092f0c5 by Serhiy Storchaka in branch '3.9': [3.9] bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 (GH-22870). (GH-22963) https://github.com/python/cpython/commit/0aaecb30483e98fc29c1f4253967d05da092f0c5 |
|||
| msg379735 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年10月27日 04:22 | |
Thanks for the fix Serhiy! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:32 | admin | set | github: 85224 |
| 2020年10月27日 04:22:53 | vstinner | set | messages: + msg379735 |
| 2020年10月25日 16:09:30 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020年10月25日 15:56:27 | serhiy.storchaka | set | messages: + msg379585 |
| 2020年10月25日 08:10:59 | serhiy.storchaka | set | pull_requests: + pull_request21880 |
| 2020年10月24日 18:14:26 | serhiy.storchaka | set | messages: + msg379532 |
| 2020年10月21日 20:52:33 | serhiy.storchaka | set | messages: + msg379251 |
| 2020年10月21日 20:47:44 | serhiy.storchaka | set | pull_requests: + pull_request21812 |
| 2020年10月21日 17:11:37 | pitrou | set | nosy:
+ pitrou messages: + msg379223 |
| 2020年10月21日 15:42:18 | corona10 | set | messages: + msg379214 |
| 2020年09月15日 20:10:45 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg376951 |
| 2020年09月10日 14:48:38 | corona10 | set | pull_requests: + pull_request21250 |
| 2020年06月21日 10:33:14 | corona10 | set | messages: + msg371993 |
| 2020年06月21日 09:58:01 | corona10 | set | pull_requests: + pull_request20201 |
| 2020年06月21日 09:45:05 | corona10 | set | messages: + msg371992 |
| 2020年06月20日 13:47:45 | corona10 | set | keywords:
+ patch stage: patch review pull_requests: + pull_request20177 |
| 2020年06月20日 13:45:04 | corona10 | set | nosy:
+ shihai1991 |
| 2020年06月20日 13:17:29 | corona10 | create | |