Projet

Général

Profil

0001-formdata-do-not-modify-__dict__-in-__getstate__-3804.patch

Benjamin Dauvergne, 28 novembre 2019 12:32

Télécharger (1,02 ko)

Voir les différences:

Subject: [PATCH] formdata: do not modify __dict__ in __getstate__ (#38049)

It suppress the _formdef cache, which can break things with transient
formdata created from the FormData class instead of a FormDef.data_class().

Ideally transient FormData should be never copied as the copy is lacking
a _formdef attribute and _names is not initialised so
FormData.get_formdef() will never work.
 wcs/formdata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
wcs/formdata.py
1106 1106

  
1107 1107
    # don't pickle _formdef cache
1108 1108
    def __getstate__(self):
1109
        odict = self.__dict__
1109
        odict = self.__dict__.copy()
1110 1110
        if '_formdef' in odict:
1111 1111
            del odict['_formdef']
1112 1112
        return odict
1113
-