msamogh/nonechucks

Potential bug in `_reset_index`

mdfirman opened this issue · 0 comments

SafeDataset._reset_index is defined as follows:

    def _reset_index(self):
        """Resets the safe and unsafe samples indices."""
        self._safe_indices = self._unsafe_indices = []

I believe this has a bug, as after calling this function _safe_indices and _unsafe_indices will both point to the same underlying list in memory.

Compare:

>> a = []
>> b = []
>> a.append(2)
>> print(b)
[]
  --> expected!

with

>> a = b = []
>> a.append(2)
>> print(b)
[2]
  --> unexpected!