bpo-36842: Implement PEP 578 (GH-12613)

Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
This commit is contained in:
Steve Dower 2019-05-23 08:45:22 -07:00 committed by GitHub
parent e788057a91
commit b82e17e626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 3565 additions and 1816 deletions

View file

@ -351,7 +351,7 @@ def _get_module_info(self, fullname):
# data_size and file_offset are 0.
def _read_directory(archive):
try:
fp = _io.open(archive, 'rb')
fp = _io.open_code(archive)
except OSError:
raise ZipImportError(f"can't open Zip file: {archive!r}", path=archive)
@ -533,7 +533,7 @@ def _get_data(archive, toc_entry):
if data_size < 0:
raise ZipImportError('negative data size')
with _io.open(archive, 'rb') as fp:
with _io.open_code(archive) as fp:
# Check to make sure the local file header is correct
try:
fp.seek(file_offset)