Skip to content

Commit ae6875f

Browse files
committed
fix: address commnets
Signed-off-by: yihong0618 <[email protected]>
1 parent 49b84a6 commit ae6875f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Lib/_pyrepl/reader.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,9 @@ def calc_screen(self) -> list[str]:
297297
if self.last_refresh_cache.valid(self):
298298
offset, num_common_lines = self.last_refresh_cache.get_cached_location(self)
299299

300-
screen = self.last_refresh_cache.screen.copy()
301-
del screen[num_common_lines:]
302-
303-
screeninfo = self.last_refresh_cache.screeninfo.copy()
304-
del screeninfo[num_common_lines:]
300+
# Use slicing instead of del to avoid modifying the cached lists.
301+
screen = self.last_refresh_cache.screen[:num_common_lines]
302+
screeninfo = self.last_refresh_cache.screeninfo[:num_common_lines]
305303

306304
pos = self.pos
307305
pos -= offset

0 commit comments

Comments
 (0)