python-dill fails to build with Python 3.14.0a1. when serializing test_dataclasses.<locals>.B object FTraceback (most recent call last): File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/dill-8b86f5094d089c32c0bba4cefd970fa8339b3f47/dill/tests/test_detect.py", line 158, in <module> test_getstate() ~~~~~~~~~~~~~^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/dill-8b86f5094d089c32c0bba4cefd970fa8339b3f47/dill/tests/test_detect.py", line 115, in test_getstate dumps(lambda: f, recurse=True) # calls __getstate__ ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 288, in dumps dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 260, in dump Pickler(file, protocol, **_kwds).dump(obj) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 428, in dump StockPickler.dump(self, obj) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 499, in dump self.save(obj) ~~~~~~~~~^^^^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 422, in save StockPickler.save(self, obj, save_persistent_id) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 572, in save f(self, obj) # Call unbound method with explicit self ~^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 2013, in save_function _save_with_postproc(pickler, (_create_function, ( ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ obj.__code__, globs, obj.__name__, obj.__defaults__, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ closure ^^^^^^^ ), state), obj=obj, postproc_list=postproc_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.3.9__20240914.8b86f509-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 1128, in _save_with_postproc pickler._batch_setitems(iter(source.items())) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ TypeError: _Pickler._batch_setitems() missing 1 required positional argument: 'obj' https://docs.python.org/3.14/whatsnew/3.14.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08189198-python-dill/ For all our attempts to build python-dill with Python 3.14, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-dill/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.14: https://copr.fedorainfracloud.org/coprs/g/python/python3.14/ Let us know here if you have any questions. Python 3.14 is planned to be included in Fedora 43. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle. Changing version to 42.
After changing the line in dill/_dill.py (to accommodate to changes published in https://github.com/python/cpython/commit/c0c2aa7644ebd4953682784dbb9904fe955ff647): - pickler._batch_setitems(iter(source.items())) + pickler._batch_setitems(iter(source.items()), obj) I get to run tests to see the failure in test_registered.py: + /usr/bin/python3 dill/tests/__main__.py .<function <lambda> at 0x7f4ad7cb1380> <function <lambda> at 0x7f012470d380> <function <lambda> at 0x7ff19d95d380> <function <lambda> at 0x7f96d19dbd70> <function <lambda> at 0x7f430e615380> ....................SUCCESS: ['CountType', 'ChainType', 'ProductType', 'CycleType', 'PermutationsType', 'CombinationsType', 'RepeatType', 'CompressType'] Traceback (most recent call last): File "/builddir/build/BUILD/python-dill-0.3.9-build/dill-0.3.9/dill/tests/test_registered.py", line 45, in <module> raise e from None File "/builddir/build/BUILD/python-dill-0.3.9-build/dill-0.3.9/dill/tests/test_registered.py", line 42, in <module> assert not bool(success) ^^^^^^^^^^^^^^^^^ AssertionError F........
I backported upstream's solution to this issue: https://src.fedoraproject.org/rpms/python-dill/pull-request/4
The current failure is: + /usr/bin/python3 dill/tests/__main__.py .<function <lambda> at 0x7fcd44b91640> <function <lambda> at 0x7fac6d4cd640> <function <lambda> at 0x7f1654c2d640> <function <lambda> at 0x7f074ec6ef00> <function <lambda> at 0x7f736f111640> ...........................Traceback (most recent call last): File "/builddir/build/BUILD/python-dill-0.4.0-build/dill-0.4.0/dill/tests/test_threads.py", line 45, in <module> test_run_thread() ~~~~~~~~~~~~~~~^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/dill-0.4.0/dill/tests/test_threads.py", line 25, in test_run_thread t_ = dill.copy(t) File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 248, in copy return loads(dumps(obj, *args, **kwds), ignore=ignore) ~~~~~^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 288, in dumps dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 260, in dump Pickler(file, protocol, **_kwds).dump(obj) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 428, in dump StockPickler.dump(self, obj) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 498, in dump self.save(obj) ~~~~~~~~~^^^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 422, in save StockPickler.save(self, obj, save_persistent_id) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 615, in save self.save_reduce(obj=obj, *rv) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 761, in save_reduce save(state) ~~~~^^^^^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 422, in save StockPickler.save(self, obj, save_persistent_id) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 572, in save f(self, obj) # Call unbound method with explicit self ~^^^^^^^^^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 1262, in save_module_dict StockPickler.save_dict(pickler, obj) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 1064, in save_dict self._batch_setitems(obj.items(), obj) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 1090, in _batch_setitems save(v) ~~~~^^^ File "/builddir/build/BUILD/python-dill-0.4.0-build/BUILDROOT/usr/lib/python3.14/site-packages/dill/_dill.py", line 422, in save StockPickler.save(self, obj, save_persistent_id) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/pickle.py", line 590, in save rv = reduce(self.proto) TypeError: cannot pickle '_contextvars.Context' object when serializing dict item '_context' when serializing threading.Thread state when serializing threading.Thread object F. ------ This is needed by rpmdevtools from @fedora-packager, raising severity.
> This is needed by rpmdevtools from @fedora-packager, raising severity. Also by rpkg and fedpkg.
https://src.fedoraproject.org/rpms/python-dill/pull-request/6