File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,8 @@ def _waveform(value, fields):
179179 length = fields .pop ('length' )
180180 datatype = initial_value .dtype
181181
182+ assert length > 0 , 'Array cannot be of zero length'
183+
182184 fields ['initial_value' ] = initial_value
183185 fields ['_wf_nelm' ] = length
184186 fields ['_wf_dtype' ] = datatype
Original file line number Diff line number Diff line change @@ -374,8 +374,9 @@ def _value_to_epics(self, value):
374374 # Because arrays are mutable values it's ever so easy to accidentially
375375 # call set() with a value which subsequently changes. To avoid this
376376 # common class of bug, at the cost of duplicated code and data, here we
377- # ensure a copy is taken of the value, after pruning to length.
378- return + value [:self ._nelm ]
377+ # ensure a copy is taken of the value.
378+ assert len (value ) <= self ._nelm , 'Value too long for waveform'
379+ return + value
379380
380381 def _epics_to_value (self , value ):
381382 return value
You can’t perform that action at this time.
0 commit comments