diff --git a/Memory.py b/Memory.py index 8e7387f..e24dbed 100644 --- a/Memory.py +++ b/Memory.py @@ -12,15 +12,15 @@ class Memory: def __getitem__(self, key: int): if key > self.size: - raise AddressError + raise AddressError(key) return self.data[key] def write(self, index: int, val: int): if index > self.size: - raise AddressError() + raise AddressError(index) self.data[index] = val - def write_batch(self, start, dt: list[int]): + def write_batch(self, start, dt): if start + len(dt) > self.size: raise OutOfMemory("内存用尽") @@ -46,12 +46,12 @@ class Memory: stop = k.stop if start > self.size or stop > self.size: - raise AddressError + raise AddressError(start) self.data[start:stop] = v return if k > self.size: - raise AddressError + raise AddressError(k) self.data[k] = v return