Projet

Général

Profil

0001-python3-use-six.binary_type-in-saml-PickledObject-ba.patch

Paul Marillonnet, 06 mars 2019 21:42

Télécharger (1,49 ko)

Voir les différences:

Subject: [PATCH] python3: use six.binary_type in saml PickledObject base field
 (#31178)

 src/authentic2/saml/fields.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/authentic2/saml/fields.py
26 26
#
27 27
# Initial author: Oliver Beattie
28 28

  
29
class PickledObject(str):
29
class PickledObject(six.binary_type):
30 30
    """A subclass of string so it can be told whether a string is
31 31
       a pickled object or not (if the object is an instance of this class
32 32
       then it must [well, should] be a pickled one)."""
......
52 52
        if isinstance(value, PickledObject):
53 53
            # If the value is a definite pickle; and an error is raised in
54 54
            # de-pickling it should be allowed to propogate.
55
            return pickle.loads(str(value))
55
            return pickle.loads(six.binary_type(value))
56 56
        else:
57 57
            try:
58
                return pickle.loads(str(value))
58
                return pickle.loads(six.binary_type(value))
59 59
            except:
60 60
                # If an error was raised, just return the plain value
61 61
                return value
62
-