When get_buffer() is called with a list of PVs, it uses epics.caget_many() internally. If any PV in the list is unreachable (returns None from caget_many), the method crashes with TypeError: 'NoneType' object is not subscriptable because it attempts to slice None:
buff_dict = {a_pv[:-suffix_length]: buff_dict[a_pv][0:self.n_measurements] for a_pv in buff_dict}
This affects both EventDefinition.get_buffer() (edef.py line 422) and BSABuffer.get_buffer() (sc_buffer.py line 423).
Expected behavior: When a PV in the list can't connect, get_buffer() should return None for that PV in the result dict instead of crashing. This allows callers to handle partial failures gracefully.
Reproduction:
import edef
buffer = edef.EventDefinition("test", user="user", edef_number=3)
# Pass a mix of valid and invalid PVs
buffer.get_buffer(["BPMS:LI24:801:TMIT", "FAKE:INVALID:PV:TMIT"])
# → TypeError: 'NoneType' object is not subscriptable
Proposed fix: Add a None check before slicing in the list comprehension:
buff_dict = {
a_pv[:-suffix_length]: buff_dict[a_pv][0:self.n_measurements]
if buff_dict[a_pv] is not None else None
for a_pv in buff_dict
}
When
get_buffer()is called with a list of PVs, it usesepics.caget_many()internally. If any PV in the list is unreachable (returnsNonefromcaget_many), the method crashes withTypeError: 'NoneType' object is not subscriptablebecause it attempts to sliceNone:This affects both
EventDefinition.get_buffer()(edef.py line 422) andBSABuffer.get_buffer()(sc_buffer.py line 423).Expected behavior: When a PV in the list can't connect,
get_buffer()should returnNonefor that PV in the result dict instead of crashing. This allows callers to handle partial failures gracefully.Reproduction:
Proposed fix: Add a None check before slicing in the list comprehension: