Skip to content

Commit d98196a

Browse files
committed
Address feedback
1 parent 56d44c0 commit d98196a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

stdlib/@tests/test_cases/check_zipfile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ def write_zip(mode: Literal["r", "w", "x", "a"]) -> None:
108108
with zipfile.ZipFile(TellableObj(), mode) as z: # type: ignore
109109
z.writestr("test.txt", "test")
110110

111-
# Tellable object should work for "w" mode.
112-
with zipfile.ZipFile(TellableObj(), "w") as z:
111+
# Tellable object shouldn't work for "w" mode.
112+
# As `__del__` will call close.
113+
with zipfile.ZipFile(TellableObj(), "w") as z: # type: ignore
113114
z.writestr("test.txt", "test")
114115

115116
# Writeable object should not work for any mode.

stdlib/zipfile/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class ZipFile:
150150
@overload
151151
def __init__(
152152
self,
153-
file: StrPath | _ZipTellable | _ZipWritable,
153+
file: StrPath | _ZipWritable,
154154
mode: Literal["w", "x"] = ...,
155155
compression: int = 0,
156156
allowZip64: bool = True,
@@ -197,7 +197,7 @@ class ZipFile:
197197
@overload
198198
def __init__(
199199
self,
200-
file: StrPath | _ZipTellable | _ZipWritable,
200+
file: StrPath | _ZipWritable,
201201
mode: Literal["w", "x"] = ...,
202202
compression: int = 0,
203203
allowZip64: bool = True,

0 commit comments

Comments
 (0)