Skip to content

Commit d88b3ee

Browse files
committed
Fix Python < 3.9 support
1 parent f2952f9 commit d88b3ee

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: cloudpickle/cloudpickle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _extract_code_globals(co):
250250
if co.co_consts:
251251
for const in co.co_consts:
252252
if isinstance(const, types.CodeType):
253-
out_names |= _extract_code_globals(const)
253+
out_names.update(_extract_code_globals(const))
254254

255255
_extract_code_globals_cache[co] = out_names
256256

Diff for: tests/cloudpickle_test.py

+4
Original file line numberDiff line numberDiff line change
@@ -2332,6 +2332,10 @@ def __type__(self):
23322332
o = MyClass()
23332333
pickle_depickle(o, protocol=self.protocol)
23342334

2335+
@pytest.mark.skipif(
2336+
sys.version_info < (3, 7),
2337+
reason="Determinism can only be guaranteed for Python 3.7+"
2338+
)
23352339
def test_deterministic_pickle_bytes_for_function(self):
23362340
# Ensure that functions with references to several global names are
23372341
# pickled to fixed bytes that do not depend on the PYTHONHASHSEED of

0 commit comments

Comments
 (0)