When parsing a corrupt, truncated, or unexpectedly encrypted .docx file,
ZipFile.read() can raise zlib.error, EOFError, RuntimeError, or
BadZipFile. These native exceptions previously escaped from
Document(stream), requiring callers to catch multiple unrelated types.
_ZipPkgReader.__init__ now wraps BadZipFile on construction, and
blob_for() wraps BadZipFile, zlib.error, EOFError, and RuntimeError,
re-raising them all as PackageNotFoundError so callers have a single
consistent docx-level exception to handle.
Fixes python-openxml#1561.
Summary
When docx.Document(stream) parses a malformed, corrupt, or unexpectedly encrypted .docx file, low-level exceptions from Python's zipfile / zlib modules escape the library boundary instead of being surfaced as a consistent python-docx exception. Callers are left catching zlib.error, EOFError, RuntimeError, or BadZipFile — unrelated internal types they should never need to know about.
This PR fixes the two callsites in _ZipPkgReader:
Callers already catch PackageNotFoundError; no API change is required on their side.
Closes #1561.
Test plan