Ignore:
Timestamp:
05/12/19 07:18:47 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Fixed pickling of PIREPs saved with Python 2 (re #347).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/pirep.py

    r919 r955  
    22from .util import utf2unicode
    33from .flight import Flight
     4from .common import fixUnpickled
    45
    56from . import const
     
    114115        try:
    115116            with open(path, "rb") as f:
    116                 pirep = pickle.load(f)
     117                pirep = pickle.load(f, fix_imports = True, encoding = "bytes")
    117118                if "numCrew" not in dir(pirep):
    118119                    pirep.numCrew = pirep.bookedFlight.numCrew
     
    412413
    413414        return ([], attrs)
     415
     416    def __setstate__(self, state):
     417        """Set the state from the given unpickled dictionary."""
     418        self.__dict__.update(fixUnpickled(state))
Note: See TracChangeset for help on using the changeset viewer.