From e0c1130a193bb0cc5c6773bb5587ed1b34c27d8d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 25 Nov 2016 19:55:56 +0100 Subject: [PATCH] Fix cache on PyPy --- cloudpickle/cloudpickle.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloudpickle/cloudpickle.py b/cloudpickle/cloudpickle.py index 25865c86a..f50265aff 100644 --- a/cloudpickle/cloudpickle.py +++ b/cloudpickle/cloudpickle.py @@ -320,10 +320,10 @@ def save_function_tuple(self, func): write(pickle.TUPLE) write(pickle.REDUCE) # applies _fill_function on the tuple - - _extract_code_globals_cache = (weakref.WeakKeyDictionary() - if sys.version_info >= (2, 7) - else {}) + _extract_code_globals_cache = ( + weakref.WeakKeyDictionary() + if sys.version_info >= (2, 7) and not hasattr(sys, "sys.pypy_version_info") + else {}) @classmethod def extract_code_globals(cls, co):