Skip to content

Commit

Permalink
ENH: Sort __globals__ dict to make pickle string more deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Apr 21, 2021
1 parent b9d2bdc commit ca7b0e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cloudpickle/cloudpickle_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def _function_getstate(func):
}

f_globals_ref = _extract_code_globals(func.__code__)
f_globals = {k: func.__globals__[k] for k in f_globals_ref if k in
func.__globals__}
f_globals = {k: func.__globals__[k] for k in sorted(f_globals_ref)
if k in func.__globals__}

closure_values = (
list(map(_get_cell_contents, func.__closure__))
Expand Down

0 comments on commit ca7b0e8

Please sign in to comment.