File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,12 @@ def _waveform(value, fields):
149149 if 'datatype' in fields :
150150 assert 'FTVL' not in fields , \
151151 'Can\' t specify FTVL and datatype together'
152- datatype = numpy .dtype (fields .pop ('datatype' ))
152+ datatype = fields .pop ('datatype' )
153+ if datatype == int or datatype == 'int' :
154+ # Convert Python int to 32-bit integer, it's all we can handle
155+ datatype = numpy .dtype ('int32' )
156+ else :
157+ datatype = numpy .dtype (datatype )
153158 elif 'FTVL' in fields :
154159 datatype = numpy .dtype (DbfStringToNumpy [fields ['FTVL' ]])
155160 else :
@@ -163,7 +168,7 @@ def _waveform(value, fields):
163168 length = fields .pop ('length' , len (initial_value ))
164169
165170 # Special case for [u]int64: if the initial value comes in as 64 bit
166- # integers cannot represent that, so recast it as [u]int32
171+ # integers we cannot represent that, so recast it as [u]int32
167172 if datatype is None :
168173 if initial_value .dtype == numpy .int64 :
169174 initial_value = numpy .require (initial_value , numpy .int32 )
You can’t perform that action at this time.
0 commit comments