https://bugzilla.redhat.com/show_bug.cgi?id=2219334
Bug ID: 2219334 Summary: python-cloudpickle: FTBFS in f39-python side tag with Python 3.12 Product: Fedora Version: rawhide URL: https://koschei.fedoraproject.org/package/python-cloud pickle Status: NEW Component: python-cloudpickle Assignee: lbalhar@redhat.com Reporter: thrnciar@redhat.com QA Contact: extras-qa@fedoraproject.org CC: epel-packagers-sig@lists.fedoraproject.org, jonathan@almalinux.org, lbalhar@redhat.com, python-packagers-sig@lists.fedoraproject.org Target Milestone: --- Classification: Fedora
python-cloudpickle fails to build with Python 3.12.0b3 in f39-sidetag
For the build logs, see: https://koji.fedoraproject.org/koji/buildinfo?buildID=2218638
To reproduce this locally you can do: fedpkg mock-config --target f39-python > ~/.config/mock/f39-python.cfg fedpkg srpm mock -r f39-python --rebuild $SRPM
Or you can submit a scratch build in side tag with: fedpkg build --target=f39-python --scratch --srpm
Once fixed, please submit the real build into side tag with: fedpkg build --target=f39-python
=================================== FAILURES =================================== ____________________ CloudPickleTest.test_generic_subclass _____________________ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_generic_subclass> def test_generic_subclass(self): T = typing.TypeVar('T')
class Base(typing.Generic[T]): pass
class DerivedAny(Base): pass
class LeafAny(DerivedAny): pass
class DerivedInt(Base[int]): pass
class LeafInt(DerivedInt): pass
class DerivedT(Base[T]): pass
class LeafT(DerivedT[T]): pass
klasses = [ Base, DerivedAny, LeafAny, DerivedInt, LeafInt, DerivedT, LeafT ] for klass in klasses:
assert pickle_depickle(klass, protocol=self.protocol) is klass
tests/cloudpickle_test.py:2423: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError ______________________ CloudPickleTest.test_generic_type _______________________ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_generic_type> def test_generic_type(self): T = typing.TypeVar('T')
class C(typing.Generic[T]): pass
assert pickle_depickle(C, protocol=self.protocol) is C
tests/cloudpickle_test.py:2364: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError __________ CloudPickleTest.test_locally_defined_class_with_type_hints __________ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_locally_defined_class_with_type_hints> def test_locally_defined_class_with_type_hints(self): with subprocess_worker(protocol=self.protocol) as worker: for type_ in _all_types_to_test(): class MyClass: def method(self, arg: type_) -> type_: return arg MyClass.__annotations__ = {'attribute': type_}
def check_annotations(obj, expected_type, expected_type_str): assert obj.__annotations__["attribute"] == expected_type assert ( obj.method.__annotations__["arg"] == expected_type ) assert ( obj.method.__annotations__["return"] == expected_type ) return "ok"
obj = MyClass() assert check_annotations(obj, type_, "type_") == "ok"
assert (
worker.run(check_annotations, obj, type_, "type_") == "ok" ) tests/cloudpickle_test.py:2457: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/testutils.py:146: in run input_payload = dumps((func, args, kwargs), protocol=self.protocol) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _ CloudPickleTest.test_pickle_constructs_from_module_registered_for_pickling_by_value _ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_pickle_constructs_from_module_registered_for_pickling_by_value> def test_pickle_constructs_from_module_registered_for_pickling_by_value(self): # noqa _prev_sys_path = sys.path.copy() try: # We simulate an interactive session that: # - we start from the /path/to/cloudpickle/tests directory, where a # local .py file (mock_local_file) is located. # - uses constructs from mock_local_file in remote workers that do # not have access to this file. This situation is # the justification behind the # (un)register_pickle_by_value(module) api that cloudpickle # exposes. _mock_interactive_session_cwd = os.path.dirname(__file__)
# First, remove sys.path entries that could point to # /path/to/cloudpickle/tests and be in inherited by the worker _maybe_remove(sys.path, '') _maybe_remove(sys.path, _mock_interactive_session_cwd)
# Add the desired session working directory sys.path.insert(0, _mock_interactive_session_cwd)
with subprocess_worker(protocol=self.protocol) as w: # Make the module unavailable in the remote worker w.run( lambda p: sys.path.remove(p), _mock_interactive_session_cwd ) # Import the actual file after starting the module since the # worker is started using fork on Linux, which will inherits # the parent sys.modules. On Python>3.6, the worker can be # started using spawn using mp_context in ProcessPoolExectutor. # TODO Once Python 3.6 reaches end of life, rely on mp_context # instead. import mock_local_folder.mod as mod # The constructs whose pickling mechanism is changed using # register_pickle_by_value are functions, classes, TypeVar and # modules. from mock_local_folder.mod import ( local_function, LocalT, LocalClass )
# Make sure the module/constructs are unimportable in the # worker. with pytest.raises(ImportError): w.run(lambda: __import__("mock_local_folder.mod")) with pytest.raises(ImportError): w.run( lambda: __import__("mock_local_folder.subfolder.mod") )
for o in [mod, local_function, LocalT, LocalClass]: with pytest.raises(ImportError): w.run(lambda: o)
register_pickle_by_value(mod) # function assert w.run(lambda: local_function()) == local_function() # typevar
assert w.run(lambda: LocalT.__name__) == LocalT.__name__
tests/cloudpickle_test.py:2583: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/testutils.py:146: in run input_payload = dumps((func, args, kwargs), protocol=self.protocol) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:911: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~LocalT, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _________________ CloudPickleTest.test_pickle_dynamic_typevar __________________ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_pickle_dynamic_typevar> def test_pickle_dynamic_typevar(self): T = typing.TypeVar('T')
depickled_T = pickle_depickle(T, protocol=self.protocol)
tests/cloudpickle_test.py:2330: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError ___________ CloudPickleTest.test_pickle_dynamic_typevar_memoization ____________ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_pickle_dynamic_typevar_memoization> def test_pickle_dynamic_typevar_memoization(self): T = typing.TypeVar('T')
depickled_T1, depickled_T2 = pickle_depickle((T, T),
protocol=self.protocol) tests/cloudpickle_test.py:2345: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _____________ CloudPickleTest.test_pickle_dynamic_typevar_tracking _____________ self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_pickle_dynamic_typevar_tracking> def test_pickle_dynamic_typevar_tracking(self): T = typing.TypeVar("T")
T2 = subprocess_pickle_echo(T, protocol=self.protocol)
tests/cloudpickle_test.py:2340: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/testutils.py:89: in subprocess_pickle_echo out = subprocess_pickle_string(input_data, tests/testutils.py:63: in subprocess_pickle_string pickle_string = dumps(input_data, protocol=protocol) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError ________________ Protocol2CloudPickleTest.test_generic_subclass ________________ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_generic_subclass> def test_generic_subclass(self): T = typing.TypeVar('T')
class Base(typing.Generic[T]): pass
class DerivedAny(Base): pass
class LeafAny(DerivedAny): pass
class DerivedInt(Base[int]): pass
class LeafInt(DerivedInt): pass
class DerivedT(Base[T]): pass
class LeafT(DerivedT[T]): pass
klasses = [ Base, DerivedAny, LeafAny, DerivedInt, LeafInt, DerivedT, LeafT ] for klass in klasses:
assert pickle_depickle(klass, protocol=self.protocol) is klass
tests/cloudpickle_test.py:2423: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError __________________ Protocol2CloudPickleTest.test_generic_type __________________ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_generic_type> def test_generic_type(self): T = typing.TypeVar('T')
class C(typing.Generic[T]): pass
assert pickle_depickle(C, protocol=self.protocol) is C
tests/cloudpickle_test.py:2364: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _____ Protocol2CloudPickleTest.test_locally_defined_class_with_type_hints ______ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_locally_defined_class_with_type_hints> def test_locally_defined_class_with_type_hints(self): with subprocess_worker(protocol=self.protocol) as worker: for type_ in _all_types_to_test(): class MyClass: def method(self, arg: type_) -> type_: return arg MyClass.__annotations__ = {'attribute': type_}
def check_annotations(obj, expected_type, expected_type_str): assert obj.__annotations__["attribute"] == expected_type assert ( obj.method.__annotations__["arg"] == expected_type ) assert ( obj.method.__annotations__["return"] == expected_type ) return "ok"
obj = MyClass() assert check_annotations(obj, type_, "type_") == "ok"
assert (
worker.run(check_annotations, obj, type_, "type_") == "ok" ) tests/cloudpickle_test.py:2457: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/testutils.py:146: in run input_payload = dumps((func, args, kwargs), protocol=self.protocol) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _ Protocol2CloudPickleTest.test_pickle_constructs_from_module_registered_for_pickling_by_value _ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_pickle_constructs_from_module_registered_for_pickling_by_value> def test_pickle_constructs_from_module_registered_for_pickling_by_value(self): # noqa _prev_sys_path = sys.path.copy() try: # We simulate an interactive session that: # - we start from the /path/to/cloudpickle/tests directory, where a # local .py file (mock_local_file) is located. # - uses constructs from mock_local_file in remote workers that do # not have access to this file. This situation is # the justification behind the # (un)register_pickle_by_value(module) api that cloudpickle # exposes. _mock_interactive_session_cwd = os.path.dirname(__file__)
# First, remove sys.path entries that could point to # /path/to/cloudpickle/tests and be in inherited by the worker _maybe_remove(sys.path, '') _maybe_remove(sys.path, _mock_interactive_session_cwd)
# Add the desired session working directory sys.path.insert(0, _mock_interactive_session_cwd)
with subprocess_worker(protocol=self.protocol) as w: # Make the module unavailable in the remote worker w.run( lambda p: sys.path.remove(p), _mock_interactive_session_cwd ) # Import the actual file after starting the module since the # worker is started using fork on Linux, which will inherits # the parent sys.modules. On Python>3.6, the worker can be # started using spawn using mp_context in ProcessPoolExectutor. # TODO Once Python 3.6 reaches end of life, rely on mp_context # instead. import mock_local_folder.mod as mod # The constructs whose pickling mechanism is changed using # register_pickle_by_value are functions, classes, TypeVar and # modules. from mock_local_folder.mod import ( local_function, LocalT, LocalClass )
# Make sure the module/constructs are unimportable in the # worker. with pytest.raises(ImportError): w.run(lambda: __import__("mock_local_folder.mod")) with pytest.raises(ImportError): w.run( lambda: __import__("mock_local_folder.subfolder.mod") )
for o in [mod, local_function, LocalT, LocalClass]: with pytest.raises(ImportError): w.run(lambda: o)
register_pickle_by_value(mod) # function assert w.run(lambda: local_function()) == local_function() # typevar
assert w.run(lambda: LocalT.__name__) == LocalT.__name__
tests/cloudpickle_test.py:2583: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/testutils.py:146: in run input_payload = dumps((func, args, kwargs), protocol=self.protocol) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:911: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~LocalT, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _____________ Protocol2CloudPickleTest.test_pickle_dynamic_typevar _____________ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_pickle_dynamic_typevar> def test_pickle_dynamic_typevar(self): T = typing.TypeVar('T')
depickled_T = pickle_depickle(T, protocol=self.protocol)
tests/cloudpickle_test.py:2330: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError _______ Protocol2CloudPickleTest.test_pickle_dynamic_typevar_memoization _______ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_pickle_dynamic_typevar_memoization> def test_pickle_dynamic_typevar_memoization(self): T = typing.TypeVar('T')
depickled_T1, depickled_T2 = pickle_depickle((T, T),
protocol=self.protocol) tests/cloudpickle_test.py:2345: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/cloudpickle_test.py:81: in pickle_depickle return pickle.loads(cloudpickle.dumps(obj, protocol=protocol)) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError ________ Protocol2CloudPickleTest.test_pickle_dynamic_typevar_tracking _________ self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_pickle_dynamic_typevar_tracking> def test_pickle_dynamic_typevar_tracking(self): T = typing.TypeVar("T")
T2 = subprocess_pickle_echo(T, protocol=self.protocol)
tests/cloudpickle_test.py:2340: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/testutils.py:89: in subprocess_pickle_echo out = subprocess_pickle_string(input_data, tests/testutils.py:63: in subprocess_pickle_string pickle_string = dumps(input_data, protocol=protocol) cloudpickle/cloudpickle_fast.py:73: in dumps cp.dump(obj) cloudpickle/cloudpickle_fast.py:632: in dump return Pickler.dump(self, obj) cloudpickle/cloudpickle.py:909: in _typevar_reduce return (_make_typevar, _decompose_typevar(obj)) cloudpickle/cloudpickle.py:899: in _decompose_typevar _get_or_create_tracker_id(obj), cloudpickle/cloudpickle.py:107: in _get_or_create_tracker_id class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <WeakKeyDictionary at 0xf6742fc0>, key = ~T, default = None def get(self, key, default=None):
return self.data.get(ref(key),default)
E TypeError: cannot create weak reference to 'typing.TypeVar' object /usr/lib/python3.12/weakref.py:452: TypeError ... =========================== short test summary info ============================ FAILED tests/cloudpickle_test.py::CloudPickleTest::test_generic_subclass - Ty... FAILED tests/cloudpickle_test.py::CloudPickleTest::test_generic_type - TypeEr... FAILED tests/cloudpickle_test.py::CloudPickleTest::test_locally_defined_class_with_type_hints FAILED tests/cloudpickle_test.py::CloudPickleTest::test_pickle_constructs_from_module_registered_for_pickling_by_value FAILED tests/cloudpickle_test.py::CloudPickleTest::test_pickle_dynamic_typevar FAILED tests/cloudpickle_test.py::CloudPickleTest::test_pickle_dynamic_typevar_memoization FAILED tests/cloudpickle_test.py::CloudPickleTest::test_pickle_dynamic_typevar_tracking FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_generic_subclass FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_generic_type FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_locally_defined_class_with_type_hints FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_pickle_constructs_from_module_registered_for_pickling_by_value FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_pickle_dynamic_typevar FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_pickle_dynamic_typevar_memoization FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_pickle_dynamic_typevar_tracking ==== 14 failed, 226 passed, 15 skipped, 5 deselected, 12 warnings in 21.86s ====