Bug 2352552 - python-simframe fails to build with Python 3.14: TypeError: cannot pickle 'itertools.cycle' object
Summary: python-simframe fails to build with Python 3.14: TypeError: cannot pickle 'it...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-simframe
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Iztok Fister, Jr.
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-03-14 13:21 UTC by Karolina Surma
Modified: 2025-03-22 19:45 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-03-14 13:21:42 UTC
python-simframe fails to build with Python 3.14.0a5.

__________________________________ test_write __________________________________

    def test_write():
        f = Frame()
        f.writer = writers.hdf5writer
        f.writer.verbosity = 0
        filename = f.writer.datadir.joinpath("test.out")
>       f.writer.write(f, 0, True, filename=filename)

tests/io/test_writer.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib/python3.14/site-packages/simframe/io/writer.py:285: in write
    self.writedump(owner)
../BUILDROOT/usr/lib/python3.14/site-packages/simframe/io/writer.py:254: in writedump
    writedump(frame, filename)
../BUILDROOT/usr/lib/python3.14/site-packages/simframe/io/dump.py:14: in writedump
    dill.dump(object, dumpfile)
/usr/lib/python3.14/site-packages/dill/_dill.py:260: in dump
    Pickler(file, protocol, **_kwds).dump(obj)
/usr/lib/python3.14/site-packages/dill/_dill.py:428: in dump
    StockPickler.dump(self, obj)
/usr/lib64/python3.14/pickle.py:498: in dump
    self.save(obj)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
/usr/lib64/python3.14/pickle.py:615: in save
    self.save_reduce(obj=obj, *rv)
/usr/lib64/python3.14/pickle.py:761: in save_reduce
    save(state)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
/usr/lib64/python3.14/pickle.py:572: in save
    f(self, obj)  # Call unbound method with explicit self
/usr/lib/python3.14/site-packages/dill/_dill.py:1236: in save_module_dict
    StockPickler.save_dict(pickler, obj)
/usr/lib64/python3.14/pickle.py:1064: in save_dict
    self._batch_setitems(obj.items(), obj)
/usr/lib64/python3.14/pickle.py:1090: in _batch_setitems
    save(v)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
/usr/lib64/python3.14/pickle.py:615: in save
    self.save_reduce(obj=obj, *rv)
/usr/lib64/python3.14/pickle.py:761: in save_reduce
    save(state)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
/usr/lib64/python3.14/pickle.py:572: in save
    f(self, obj)  # Call unbound method with explicit self
/usr/lib/python3.14/site-packages/dill/_dill.py:1236: in save_module_dict
    StockPickler.save_dict(pickler, obj)
/usr/lib64/python3.14/pickle.py:1064: in save_dict
    self._batch_setitems(obj.items(), obj)
/usr/lib64/python3.14/pickle.py:1090: in _batch_setitems
    save(v)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
/usr/lib64/python3.14/pickle.py:615: in save
    self.save_reduce(obj=obj, *rv)
/usr/lib64/python3.14/pickle.py:761: in save_reduce
    save(state)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
/usr/lib64/python3.14/pickle.py:572: in save
    f(self, obj)  # Call unbound method with explicit self
/usr/lib/python3.14/site-packages/dill/_dill.py:1236: in save_module_dict
    StockPickler.save_dict(pickler, obj)
/usr/lib64/python3.14/pickle.py:1064: in save_dict
    self._batch_setitems(obj.items(), obj)
/usr/lib64/python3.14/pickle.py:1099: in _batch_setitems
    save(v)
/usr/lib/python3.14/site-packages/dill/_dill.py:422: in save
    StockPickler.save(self, obj, save_persistent_id)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <dill._dill.Pickler object at 0x7f831c72b5c0>
obj = <itertools.cycle object at 0x7f8313f273c0>, save_persistent_id = True

    def save(self, obj, save_persistent_id=True):
        self.framer.commit_frame()
    
        # Check for persistent id (defined by a subclass)
        if save_persistent_id:
            pid = self.persistent_id(obj)
            if pid is not None:
                self.save_pers(pid)
                return
    
        # Check the memo
        x = self.memo.get(id(obj))
        if x is not None:
            self.write(self.get(x[0]))
            return
    
        rv = NotImplemented
        reduce = getattr(self, "reducer_override", _NoValue)
        if reduce is not _NoValue:
            rv = reduce(obj)
    
        if rv is NotImplemented:
            # Check the type dispatch table
            t = type(obj)
            f = self.dispatch.get(t)
            if f is not None:
                f(self, obj)  # Call unbound method with explicit self
                return
    
            # Check private dispatch table if any, or else
            # copyreg.dispatch_table
            reduce = getattr(self, 'dispatch_table', dispatch_table).get(t, _NoValue)
            if reduce is not _NoValue:
                rv = reduce(obj)
            else:
                # Check for a class with a custom metaclass; treat as regular
                # class
                if issubclass(t, type):
                    self.save_global(obj)
                    return
    
                # Check for a __reduce_ex__ method, fall back to __reduce__
                reduce = getattr(obj, "__reduce_ex__", _NoValue)
                if reduce is not _NoValue:
>                   rv = reduce(self.proto)
E                   TypeError: cannot pickle 'itertools.cycle' object
E                   when serializing dict item '_cycle'
E                   when serializing simframe.io.progress.Spinner state
E                   when serializing simframe.io.progress.Spinner object
E                   when serializing dict item '_spinner'
E                   when serializing simframe.io.progress.Progressbar state
E                   when serializing simframe.io.progress.Progressbar object
E                   when serializing dict item '_progressbar'
E                   when serializing simframe.frame.frame.Frame state
E                   when serializing simframe.frame.frame.Frame object


From: https://docs.python.org/dev/whatsnew/3.14.html#itertools

Remove itertools support for copy, deepcopy, and pickle operations. These had previously raised a DeprecationWarning since Python 3.12. (Contributed by Raymond Hettinger in gh-101588.)


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08768253-python-simframe/

For all our attempts to build python-simframe with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-simframe/

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.

Comment 1 Sandro 2025-03-22 19:45:51 UTC
This appears to be an issue with `dill`. The tests fail in `writedump`[1], which calls `dill.dump()`.

This happens also with dill-0.3.9-3, which itself builds fine with Python 3.14 (bug 2323157) using upstream's patch[2].

[1] https://github.com/stammler/simframe/blob/d9cd66eafbc341b36ccc14d63afb46921f58c589/simframe/io/dump.py#L4C1-L14C36
[2] https://src.fedoraproject.org/rpms/python-dill/pull-request/4


Note You need to log in before you can comment on or make changes to this bug.