From 13047c2443f331e4d91fe4bd91420cf71733c1ff Mon Sep 17 00:00:00 2001 From: moyan <1561515308@qq.com> Date: Tue, 7 May 2024 16:41:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Memory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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