Skip to content

Commit

Permalink
Fix Python < 3.9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrisel committed Jun 30, 2021
1 parent f2952f9 commit d88b3ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cloudpickle/cloudpickle.py
Expand Up @@ -250,7 +250,7 @@ def _extract_code_globals(co):
if co.co_consts:
for const in co.co_consts:
if isinstance(const, types.CodeType):
out_names |= _extract_code_globals(const)
out_names.update(_extract_code_globals(const))

_extract_code_globals_cache[co] = out_names

Expand Down
4 changes: 4 additions & 0 deletions tests/cloudpickle_test.py
Expand Up @@ -2332,6 +2332,10 @@ def __type__(self):
o = MyClass()
pickle_depickle(o, protocol=self.protocol)

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

0 comments on commit d88b3ee

Please sign in to comment.