-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed as not planned
Closed as not planned
Copy link
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
I am not sure if this can be considered a regression or not, but the following cloudpickle code that used to work with CPython 3.13 no longer works with CPython 3.14:
from abc import ABC
import cloudpickle
def class_factory():
class Model(ABC):
field: int
return Model
cloudpickle.dumps(class_factory())
"""
TypeError: cannot pickle '_abc._abc_data' object
when serializing dict item '_abc_impl'
when serializing tuple item 0
when serializing cell reconstructor arguments
when serializing cell object
when serializing tuple item 0
when serializing dict item '__closure__'
when serializing tuple item 1
when serializing function state
when serializing function object
when serializing dict item '__annotate_func__'
when serializing tuple item 0
when serializing abc.ABCMeta state
when serializing abc.ABCMeta object
"""Note that removing the type annotation, e.g. with:
class Model(ABC):
field = 0makes the problem vanish.
Since I have no idea about the internals of _abc._abc_data and how they relate to type annotations, I would appreciate some opinions if this change of behavior of CPython is intended or not and if it is, how we could deal with it in cloudpickle.
Original issue on the cloudpickle tracker: cloudpipe/cloudpickle#572
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error