Skip to content

Commit e044971

Browse files
committed
BaseColumn: fix DataMatrix import when unpickling
1 parent 1aead15 commit e044971

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

datamatrix/_datamatrix/_basecolumn.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ def __init__(self, datamatrix, rowid=None, seq=None, metadata=None):
111111
self._init_seq()
112112
else:
113113
self._seq = seq
114+
115+
def __setstate__(self, state):
116+
117+
"""
118+
desc:
119+
Restores the object's state when loaded from a pickle. This
120+
performs the same global DataMatrix import that __init__ does,
121+
because __init__ is not called during unpickling.
122+
"""
123+
124+
global DataMatrix
125+
from datamatrix import DataMatrix
126+
super().__setstate__(state)
114127

115128
@property
116129
def loaded(self):

0 commit comments

Comments
 (0)