zipfile.ZipFile: fix fp, extract (#3828)

* zipfile: fp is None in a lot of error cases

* zipfile: pwd can be None in extract

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-03-06 14:57:06 -08:00
committed by GitHub
parent e5a276c94f
commit 2d82e1fb8b
2 changed files with 2 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ class ZipFile:
debug: int
comment: bytes
filelist: List[ZipInfo]
fp: IO[bytes]
fp: Optional[IO[bytes]]
NameToInfo: Dict[Text, ZipInfo]
start_dir: int # undocumented
if sys.version_info >= (3, 8):
@@ -102,7 +102,7 @@ class ZipFile:
def infolist(self) -> List[ZipInfo]: ...
def namelist(self) -> List[Text]: ...
def open(self, name: _SZI, mode: Text = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
def extract(self, member: _SZI, path: Optional[_SZI] = ..., pwd: bytes = ...) -> str: ...
def extract(self, member: _SZI, path: Optional[_SZI] = ..., pwd: Optional[bytes] = ...) -> str: ...
def extractall(
self, path: Optional[_Path] = ..., members: Optional[Iterable[Text]] = ..., pwd: Optional[bytes] = ...
) -> None: ...

View File

@@ -915,6 +915,4 @@ xml.etree.cElementTree.TreeBuilder.start
xml.sax.xmlreader.AttributesImpl.has_key
zipfile.ZipExtFile.read
zipfile.ZipExtFile.readline
zipfile.ZipFile.extract
zipfile.ZipFile.fp
zlib.compressobj