Projet

Général

Profil

Bug #24033

disparition de formdef.fields

Ajouté par Frédéric Péters il y a presque 6 ans. Mis à jour il y a plus de 5 ans.

Statut:
Fermé
Priorité:
Immediat
Assigné à:
Version cible:
-
Début:
23 mai 2018
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Depuis le chargement léger de formdefs légers (#23028), il peut arriver que plouf, formdef.fields "devienne" None.


Fichiers

Révisions associées

Révision 832a34c0 (diff)
Ajouté par Frédéric Péters il y a presque 6 ans

misc: add dedicated methods for copy and deepcopy (#24033)

copy and deepcopy are recycling getstate originally defined for
pickling objects; however we have a custom getstate method for
formdefs because we want to save fields in a different pickle chunk.

But while removing fields in getstate during pickling wouldn't
affect a "live" object, copy/deepcopy are supposed to create usable
objects, and a formdef with its fields attribute reduced to None
doesn't qualify.

Practically this could cause all sorts of malfunctions including a
not-so-subtle removal of all fields (if the copied formdef was stored
on disk).

Historique

#2

Mis à jour par Frédéric Péters il y a presque 6 ans

L'explication dans le message de commit :

    copy and deepcopy are recycling __getstate__ originally defined for
    pickling objects; however we have a custom __getstate__ method for
    methods because we want to save fields in a different pickle chunk.

    But calls to copy/deepcopy won't restore fields properly and create
    copies with formdef as None.  This could cause all sorts of malfunctions
    including a not so subtle removal of all fields (if the copied formdef
    was stored on disk).
#3

Mis à jour par Thomas Noël il y a presque 6 ans

Ack pour le code (avec le message de commit revu comme discuté en jabber)

#4

Mis à jour par Frédéric Péters il y a presque 6 ans

  • Statut changé de En cours à Résolu (à déployer)
commit 832a34c03261851fb82ff64595d9a8a9f88313d4
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Wed May 23 17:14:28 2018 +0200

    misc: add dedicated methods for copy and deepcopy (#24033)

    copy and deepcopy are recycling __getstate__ originally defined for
    pickling objects; however we have a custom __getstate__ method for
    formdefs because we want to save fields in a different pickle chunk.

    But while removing fields in __getstate__ during pickling wouldn't
    affect a "live" object, copy/deepcopy are supposed to create usable
    objects, and a formdef with its fields attribute reduced to None
    doesn't qualify.

    Practically this could cause all sorts of malfunctions including a
    not-so-subtle removal of all fields (if the copied formdef was stored
    on disk).
#5

Mis à jour par Frédéric Péters il y a plus de 5 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF