File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,12 @@ class MatStruct(np.recarray):
64
64
65
65
66
66
class Blob :
67
- def __init__ (self , squeeze = False ):
67
+ def __init__ (self , squeeze = False , is_32_bit = False ):
68
68
self ._squeeze = squeeze
69
69
self ._blob = None
70
70
self ._pos = 0
71
71
self .protocol = None
72
- self .is_32_bit = False
72
+ self .is_32_bit = is_32_bit
73
73
74
74
def set_dj0 (self ):
75
75
if not config .get ('enable_python_native_blobs' ):
@@ -104,11 +104,7 @@ def unpack(self, blob):
104
104
self ._pos = 0
105
105
blob_format = self .read_zero_terminated_string ()
106
106
if blob_format in ('mYm' , 'dj0' ):
107
- try :
108
- return self .read_blob (n_bytes = len (self ._blob ) - self ._pos )
109
- except :
110
- self .is_32_bit = True
111
- return self .read_blob (n_bytes = len (self ._blob ) - self ._pos )
107
+ return self .read_blob (n_bytes = len (self ._blob ) - self ._pos )
112
108
113
109
def read_blob (self , n_bytes = None ):
114
110
start = self ._pos
@@ -472,4 +468,7 @@ def unpack(blob, squeeze=False):
472
468
assert isinstance (blob , bytes ) and blob .startswith ((b'ZL123\0 ' , b'mYm\0 ' , b'dj0\0 ' ))
473
469
return blob
474
470
if blob is not None :
475
- return Blob (squeeze = squeeze ).unpack (blob )
471
+ try :
472
+ return Blob (squeeze = squeeze ).unpack (blob )
473
+ except :
474
+ return Blob (squeeze = squeeze , is_32_bit = True ).unpack (blob )
You can’t perform that action at this time.
0 commit comments