-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-26579: Add object.__getstate__(). #2821
bpo-26579: Add object.__getstate__(). #2821
Conversation
Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.
@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @pitrou, @rhettinger and @tim-one to be potential reviewers. |
Added ``object.__getstate__`` which provides the default implementation of | ||
the ``__getstate__()`` method. | ||
|
||
Copying and pickling instances of subclasses of builtin types bytearray, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interpreted text roles could be used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I afraid that it would add too much noise. All links are added in What's New.
Any progress? I opened a similar issue about |
This PR is stale because it has been open for 30 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm impressed this is a big change, but unfortunately I couldn't run the full test suite. So starting off with
test_divide_and_round fails with Issue45229 outstanding
Then
test_bad_getattr (Lib.test.pickletester.AbstractPickleTests) ... ERROR
With so many failures:
Test suite interrupted by signal SIGINT.
4 tests omitted:
test_multiprocessing_fork test_multiprocessing_forkserver
test_multiprocessing_spawn test_poplib
378 tests OK.
15 tests failed:
test_asyncio test_dbm test_float test_ftplib test_httplib
test_imaplib test_logging test_nntplib test_ossaudiodev
test_shutil test_ssl test_tk test_ttk_guionly
test_urllib2_localnet test_xmlrpc_net
9 tests skipped:
test_devpoll test_kqueue test_msilib test_nis test_startfile
test_winconsoleio test_winreg test_winsound test_zipfile64
Total duration: 69 min 27 sec
Tests result: FAILURE
cpython on object-getstate [$?] via 🐍 v3.11.0a3+ took 1h9m27s
Just makes testing a nightmare!
This has broken cython (see cython/cython#4730). |
I'm fairly sure the break to Cython is understood and easy to fix in Cython (cython/cython#4730 (comment)) so please don't revert this on Cython's behalf! |
This has also broken jsonpickle: jsonpickle/jsonpickle#395 |
edit: never mind, was looking at the 3.10 docs not the 3.11 docs. 3.11 docs cover what |
As another bread crumb: |
Ignore the `object.__getstate__()` added with python/cpython#2821 because it is not suitable for extension types. GitHub testing: #64 TGP testing is not needed: * This CL only changes a .cc file. * The change is a no-op for Python <= 3.10. PiperOrigin-RevId: 547855607
Copying and pickling instances of subclasses of builtin types
bytearray, set, frozenset, collections.OrderedDict, collections.deque,
weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
implemented as slots.
https://bugs.python.org/issue26579