From c5dcf75a813174ac5b27b4bc1fdeba1243e04347 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 23 May 2017 11:05:03 +0200 Subject: [PATCH] [FIX] P3: Unpickler.find_global -> Unpickler.find_class --- odoo/tools/misc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py index a698bf394e8..03b784dec2e 100644 --- a/odoo/tools/misc.py +++ b/odoo/tools/misc.py @@ -1104,10 +1104,12 @@ def _consteq(str1, str2): consteq = getattr(passlib.utils, 'consteq', _consteq) +# forbid globals entirely: str/unicode, int/long, float, bool, tuple, list, dict, None +class Unpickler(pickle_.Unpickler, object): + find_global = None # Python 2 + find_class = None # Python 3 def _pickle_load(stream, errors=False): - unpickler = pickle_.Unpickler(stream) - # pickle builtins: str/unicode, int/long, float, bool, tuple, list, dict, None - unpickler.find_global = None + unpickler = Unpickler(stream) try: return unpickler.load() except Exception: