Commit 79d1c2e6 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

bpo-25711: Rewrite zipimport in pure Python. (GH-6809)

parent 4ba3b50b
......@@ -64,6 +64,7 @@ class PythonValuesTestCase(unittest.TestCase):
bootstrap_expected = [
b'_frozen_importlib',
b'_frozen_importlib_external',
b'zipimport',
]
for entry in ft:
# This is dangerous. We *can* iterate over a pointer, but
......
......@@ -48,8 +48,8 @@ else:
sys.modules['importlib._bootstrap_external'] = _bootstrap_external
# To simplify imports in test code
_w_long = _bootstrap_external._w_long
_r_long = _bootstrap_external._r_long
_pack_uint32 = _bootstrap_external._pack_uint32
_unpack_uint32 = _bootstrap_external._unpack_uint32
# Fully bootstrapped at this point, import whatever you like, circular
# dependencies and startup overhead minimisation permitting :)
......
......@@ -43,14 +43,20 @@ def _make_relax_case():
return _relax_case
def _w_long(x):
def _pack_uint32(x):
"""Convert a 32-bit integer to little-endian."""
return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')
def _r_long(int_bytes):
def _unpack_uint32(data):
"""Convert 4 bytes in little-endian to an integer."""
return int.from_bytes(int_bytes, 'little')
assert len(data) == 4
return int.from_bytes(data, 'little')
def _unpack_uint16(data):
"""Convert 2 bytes in little-endian to an integer."""
assert len(data) == 2
return int.from_bytes(data, 'little')
def _path_join(*path_parts):
......@@ -503,7 +509,7 @@ def _classify_pyc(data, name, exc_details):
message = f'reached EOF while reading pyc header of {name!r}'
_bootstrap._verbose_message('{}', message)
raise EOFError(message)
flags = _r_long(data[4:8])
flags = _unpack_uint32(data[4:8])
# Only the first two flags are defined.
if flags & ~0b11:
message = f'invalid flags {flags!r} in {name!r}'
......@@ -530,12 +536,12 @@ def _validate_timestamp_pyc(data, source_mtime, source_size, name,
An ImportError is raised if the bytecode is stale.
"""
if _r_long(data[8:12]) != (source_mtime & 0xFFFFFFFF):
if _unpack_uint32(data[8:12]) != (source_mtime & 0xFFFFFFFF):
message = f'bytecode is stale for {name!r}'
_bootstrap._verbose_message('{}', message)
raise ImportError(message, **exc_details)
if (source_size is not None and
_r_long(data[12:16]) != (source_size & 0xFFFFFFFF)):
_unpack_uint32(data[12:16]) != (source_size & 0xFFFFFFFF)):
raise ImportError(f'bytecode is stale for {name!r}', **exc_details)
......@@ -579,9 +585,9 @@ def _compile_bytecode(data, name=None, bytecode_path=None, source_path=None):
def _code_to_timestamp_pyc(code, mtime=0, source_size=0):
"Produce the data for a timestamp-based pyc."
data = bytearray(MAGIC_NUMBER)
data.extend(_w_long(0))
data.extend(_w_long(mtime))
data.extend(_w_long(source_size))
data.extend(_pack_uint32(0))
data.extend(_pack_uint32(mtime))
data.extend(_pack_uint32(source_size))
data.extend(marshal.dumps(code))
return data
......@@ -590,7 +596,7 @@ def _code_to_hash_pyc(code, source_hash, checked=True):
"Produce the data for a hash-based pyc."
data = bytearray(MAGIC_NUMBER)
flags = 0b1 | checked << 1
data.extend(_w_long(flags))
data.extend(_pack_uint32(flags))
assert len(source_hash) == 8
data.extend(source_hash)
data.extend(marshal.dumps(code))
......
......@@ -726,7 +726,7 @@ class StateTestCase(BaseTestCase):
('line', 2, 'tfunc_import'), ('step', ),
('line', 3, 'tfunc_import'), ('quit', ),
]
skip = ('importlib*', TEST_MODULE)
skip = ('importlib*', 'zipimport', TEST_MODULE)
with TracerRun(self, skip=skip) as tracer:
tracer.runcall(tfunc_import)
......
......@@ -629,7 +629,7 @@ class SourceLoaderBadBytecodeTest:
bytecode_file.write(zeros)
self.import_(mapping['_temp'], '_temp')
source_mtime = os.path.getmtime(mapping['_temp'])
source_timestamp = self.importlib._w_long(source_mtime)
source_timestamp = self.importlib._pack_uint32(source_mtime)
with open(bytecode_path, 'rb') as bytecode_file:
bytecode_file.seek(8)
self.assertEqual(bytecode_file.read(4), source_timestamp)
......
......@@ -712,9 +712,9 @@ class SourceLoader(SourceOnlyLoader):
if magic is None:
magic = self.util.MAGIC_NUMBER
data = bytearray(magic)
data.extend(self.init._w_long(0))
data.extend(self.init._w_long(self.source_mtime))
data.extend(self.init._w_long(self.source_size))
data.extend(self.init._pack_uint32(0))
data.extend(self.init._pack_uint32(self.source_mtime))
data.extend(self.init._pack_uint32(self.source_size))
code_object = compile(self.source, self.path, 'exec',
dont_inherit=True)
data.extend(marshal.dumps(code_object))
......@@ -876,9 +876,9 @@ class SourceLoaderBytecodeTests(SourceLoaderTestHarness):
if bytecode_written:
self.assertIn(self.cached, self.loader.written)
data = bytearray(self.util.MAGIC_NUMBER)
data.extend(self.init._w_long(0))
data.extend(self.init._w_long(self.loader.source_mtime))
data.extend(self.init._w_long(self.loader.source_size))
data.extend(self.init._pack_uint32(0))
data.extend(self.init._pack_uint32(self.loader.source_mtime))
data.extend(self.init._pack_uint32(self.loader.source_size))
data.extend(marshal.dumps(code_object))
self.assertEqual(self.loader.written[self.cached], bytes(data))
......
......@@ -551,7 +551,12 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
z.writestr(name, data)
z.close()
zi = zipimport.zipimporter(TEMP_ZIP)
self.assertEqual(data, zi.get_data(FunnyStr(name)))
try:
data2 = zi.get_data(FunnyStr(name))
except AttributeError:
pass
else:
self.assertEqual(data2, data)
finally:
z.close()
os.remove(TEMP_ZIP)
......@@ -677,9 +682,9 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
zipimport.zipimporter(filename)
zipimport.zipimporter(os.fsencode(filename))
with self.assertWarns(DeprecationWarning):
with self.assertRaises(TypeError):
zipimport.zipimporter(bytearray(os.fsencode(filename)))
with self.assertWarns(DeprecationWarning):
with self.assertRaises(TypeError):
zipimport.zipimporter(memoryview(os.fsencode(filename)))
@support.cpython_only
......@@ -687,14 +692,14 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
# The interpreter shouldn't crash in case of calling methods of an
# uninitialized zipimport.zipimporter object.
zi = zipimport.zipimporter.__new__(zipimport.zipimporter)
self.assertRaises(ValueError, zi.find_module, 'foo')
self.assertRaises(ValueError, zi.find_loader, 'foo')
self.assertRaises(ValueError, zi.load_module, 'foo')
self.assertRaises(ValueError, zi.get_filename, 'foo')
self.assertRaises(ValueError, zi.is_package, 'foo')
self.assertRaises(ValueError, zi.get_data, 'foo')
self.assertRaises(ValueError, zi.get_code, 'foo')
self.assertRaises(ValueError, zi.get_source, 'foo')
self.assertRaises((ValueError, AttributeError), zi.find_module, 'foo')
self.assertRaises((ValueError, AttributeError), zi.find_loader, 'foo')
self.assertRaises((ValueError, AttributeError), zi.load_module, 'foo')
self.assertRaises((ValueError, AttributeError), zi.get_filename, 'foo')
self.assertRaises((ValueError, AttributeError), zi.is_package, 'foo')
self.assertRaises((ValueError, AttributeError), zi.get_data, 'foo')
self.assertRaises((ValueError, AttributeError), zi.get_code, 'foo')
self.assertRaises((ValueError, AttributeError), zi.get_source, 'foo')
@support.requires_zlib
......@@ -712,7 +717,7 @@ class CompressedZipImportTestCase(UncompressedZipImportTestCase):
zip_file.writestr('bar.py', b'print("hello world")', ZIP_DEFLATED)
zi = zipimport.zipimporter(TEMP_ZIP)
with support.swap_attr(zlib, 'decompress', bad_decompress):
self.assertRaises(TypeError, zi.get_source, 'bar')
self.assertRaises((TypeError, AttributeError), zi.get_source, 'bar')
class BadFileZipImportTestCase(unittest.TestCase):
......
"""zipimport provides support for importing Python modules from Zip archives.
This module exports three objects:
- zipimporter: a class; its constructor takes a path to a Zip archive.
- ZipImportError: exception raised by zipimporter objects. It's a
subclass of ImportError, so it can be caught as ImportError, too.
- _zip_directory_cache: a dict, mapping archive paths to zip directory
info dicts, as used in zipimporter._files.
It is usually not needed to use the zipimport module explicitly; it is
used by the builtin import mechanism for sys.path items that are paths
to Zip archives.
"""
#from importlib import _bootstrap_external
#from importlib import _bootstrap # for _verbose_message
import _frozen_importlib_external as _bootstrap_external
from _frozen_importlib_external import _unpack_uint16, _unpack_uint32
import _frozen_importlib as _bootstrap # for _verbose_message
import _imp # for check_hash_based_pycs
import _io # for open
import marshal # for loads
import sys # for modules
import time # for mktime
__all__ = ['ZipImportError', 'zipimporter']
path_sep = _bootstrap_external.path_sep
alt_path_sep = _bootstrap_external.path_separators[1:]
class ZipImportError(ImportError):
pass
# _read_directory() cache
_zip_directory_cache = {}
_module_type = type(sys)
class zipimporter:
"""zipimporter(archivepath) -> zipimporter object
Create a new zipimporter instance. 'archivepath' must be a path to
a zipfile, or to a specific path inside a zipfile. For example, it can be
'/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a
valid directory inside the archive.
'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip
archive.
The 'archive' attribute of zipimporter objects contains the name of the
zipfile targeted.
"""
# Split the "subdirectory" from the Zip archive path, lookup a matching
# entry in sys.path_importer_cache, fetch the file directory from there
# if found, or else read it from the archive.
def __init__(self, path):
if not isinstance(path, str):
import os
path = os.fsdecode(path)
if not path:
raise ZipImportError('archive path is empty', path=path)
if alt_path_sep:
path = path.replace(alt_path_sep, path_sep)
prefix = []
while True:
try:
st = _bootstrap_external._path_stat(path)
except (OSError, ValueError):
# On Windows a ValueError is raised for too long paths.
# Back up one path element.
dirname, basename = _bootstrap_external._path_split(path)
if dirname == path:
raise ZipImportError('not a Zip file', path=path)
path = dirname
prefix.append(basename)
else:
# it exists
if (st.st_mode & 0o170000) != 0o100000: # stat.S_ISREG
# it's a not file
raise ZipImportError('not a Zip file', path=path)
break
try:
files = _zip_directory_cache[path]
except KeyError:
files = _read_directory(path)
_zip_directory_cache[path] = files
self._files = files
self.archive = path
# a prefix directory following the ZIP file path.
self.prefix = _bootstrap_external._path_join(*prefix[::-1])
if self.prefix:
self.prefix += path_sep
# Check whether we can satisfy the import of the module named by
# 'fullname', or whether it could be a portion of a namespace
# package. Return self if we can load it, a string containing the
# full path if it's a possible namespace portion, None if we
# can't load it.
def find_loader(self, fullname, path=None):
"""find_loader(fullname, path=None) -> self, str or None.
Search for a module specified by 'fullname'. 'fullname' must be the
fully qualified (dotted) module name. It returns the zipimporter
instance itself if the module was found, a string containing the
full path name if it's possibly a portion of a namespace package,
or None otherwise. The optional 'path' argument is ignored -- it's
there for compatibility with the importer protocol.
"""
mi = _get_module_info(self, fullname)
if mi is not None:
# This is a module or package.
return self, []
# Not a module or regular package. See if this is a directory, and
# therefore possibly a portion of a namespace package.
# We're only interested in the last path component of fullname
# earlier components are recorded in self.prefix.
modpath = _get_module_path(self, fullname)
if _is_dir(self, modpath):
# This is possibly a portion of a namespace
# package. Return the string representing its path,
# without a trailing separator.
return None, [f'{self.archive}{path_sep}{modpath}']
return None, []
# Check whether we can satisfy the import of the module named by
# 'fullname'. Return self if we can, None if we can't.
def find_module(self, fullname, path=None):
"""find_module(fullname, path=None) -> self or None.
Search for a module specified by 'fullname'. 'fullname' must be the
fully qualified (dotted) module name. It returns the zipimporter
instance itself if the module was found, or None if it wasn't.
The optional 'path' argument is ignored -- it's there for compatibility
with the importer protocol.
"""
return self.find_loader(fullname, path)[0]
def get_code(self, fullname):
"""get_code(fullname) -> code object.
Return the code object for the specified module. Raise ZipImportError
if the module couldn't be found.
"""
code, ispackage, modpath = _get_module_code(self, fullname)
return code
def get_data(self, pathname):
"""get_data(pathname) -> string with file data.
Return the data associated with 'pathname'. Raise OSError if
the file wasn't found.
"""
if alt_path_sep:
pathname = pathname.replace(alt_path_sep, path_sep)
key = pathname
if pathname.startswith(self.archive + path_sep):
key = pathname[len(self.archive + path_sep):]
try:
toc_entry = self._files[key]
except KeyError:
raise OSError(0, '', key)
return _get_data(self.archive, toc_entry)
# Return a string matching __file__ for the named module
def get_filename(self, fullname):
"""get_filename(fullname) -> filename string.
Return the filename for the specified module.
"""
# Deciding the filename requires working out where the code
# would come from if the module was actually loaded
code, ispackage, modpath = _get_module_code(self, fullname)
return modpath
def get_source(self, fullname):
"""get_source(fullname) -> source string.
Return the source code for the specified module. Raise ZipImportError
if the module couldn't be found, return None if the archive does
contain the module, but has no source for it.
"""
mi = _get_module_info(self, fullname)
if mi is None:
raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
path = _get_module_path(self, fullname)
if mi:
fullpath = _bootstrap_external._path_join(path, '__init__.py')
else:
fullpath = f'{path}.py'
try:
toc_entry = self._files[fullpath]
except KeyError:
# we have the module, but no source
return None
return _get_data(self.archive, toc_entry).decode()
# Return a bool signifying whether the module is a package or not.
def is_package(self, fullname):
"""is_package(fullname) -> bool.
Return True if the module specified by fullname is a package.
Raise ZipImportError if the module couldn't be found.
"""
mi = _get_module_info(self, fullname)
if mi is None:
raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
return mi
# Load and return the module named by 'fullname'.
def load_module(self, fullname):
"""load_module(fullname) -> module.
Load the module specified by 'fullname'. 'fullname' must be the
fully qualified (dotted) module name. It returns the imported
module, or raises ZipImportError if it wasn't found.
"""
code, ispackage, modpath = _get_module_code(self, fullname)
mod = sys.modules.get(fullname)
if mod is None or not isinstance(mod, _module_type):
mod = _module_type(fullname)
sys.modules[fullname] = mod
mod.__loader__ = self
try:
if ispackage:
# add __path__ to the module *before* the code gets
# executed
path = _get_module_path(self, fullname)
fullpath = _bootstrap_external._path_join(self.archive, path)
mod.__path__ = [fullpath]
if not hasattr(mod, '__builtins__'):
mod.__builtins__ = __builtins__
_bootstrap_external._fix_up_module(mod.__dict__, fullname, modpath)
exec(code, mod.__dict__)
except:
del sys.modules[fullname]
raise
try:
mod = sys.modules[fullname]
except KeyError:
raise ImportError(f'Loaded module {fullname!r} not found in sys.modules')
_bootstrap._verbose_message('import {} # loaded from Zip {}', fullname, modpath)
return mod
def get_resource_reader(self, fullname):
"""Return the ResourceReader for a package in a zip file.
If 'fullname' is a package within the zip file, return the
'ResourceReader' object for the package. Otherwise return None.
"""
from importlib import resources
return resources._zipimport_get_resource_reader(self, fullname)
def __repr__(self):
return f'<zipimporter object "{self.archive}{path_sep}{self.prefix}">'
# _zip_searchorder defines how we search for a module in the Zip
# archive: we first search for a package __init__, then for
# non-package .pyc, and .py entries. The .pyc entries
# are swapped by initzipimport() if we run in optimized mode. Also,
# '/' is replaced by path_sep there.
_zip_searchorder = (
(path_sep + '__init__.pyc', True, True),
(path_sep + '__init__.py', False, True),
('.pyc', True, False),
('.py', False, False),
)
# Given a module name, return the potential file path in the
# archive (without extension).
def _get_module_path(self, fullname):
return self.prefix + fullname.rpartition('.')[2]
# Does this path represent a directory?
def _is_dir(self, path):
# See if this is a "directory". If so, it's eligible to be part
# of a namespace package. We test by seeing if the name, with an
# appended path separator, exists.
dirpath = path + path_sep
# If dirpath is present in self._files, we have a directory.
return dirpath in self._files
# Return some information about a module.
def _get_module_info(self, fullname):
path = _get_module_path(self, fullname)
for suffix, isbytecode, ispackage in _zip_searchorder:
fullpath = path + suffix
if fullpath in self._files:
return ispackage
return None
# implementation
# _read_directory(archive) -> files dict (new reference)
#
# Given a path to a Zip archive, build a dict, mapping file names
# (local to the archive, using SEP as a separator) to toc entries.
#
# A toc_entry is a tuple:
#
# (__file__, # value to use for __file__, available for all files,
# # encoded to the filesystem encoding
# compress, # compression kind; 0 for uncompressed
# data_size, # size of compressed data on disk
# file_size, # size of decompressed data
# file_offset, # offset of file header from start of archive
# time, # mod time of file (in dos format)
# date, # mod data of file (in dos format)
# crc, # crc checksum of the data
# )
#
# Directories can be recognized by the trailing path_sep in the name,
# data_size and file_offset are 0.
def _read_directory(archive):
try:
fp = _io.open(archive, 'rb')
except OSError:
raise ZipImportError(f"can't open Zip file: {archive!r}", path=archive)
with fp:
try:
fp.seek(-22, 2)
header_position = fp.tell()
buffer = fp.read(22)
except OSError:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
if len(buffer) != 22:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
if buffer[:4] != b'PK\x05\x06':
# Bad: End of Central Dir signature
raise ZipImportError(f'not a Zip file: {archive!r}', path=archive)
header_size = _unpack_uint32(buffer[12:16])
header_offset = _unpack_uint32(buffer[16:20])
if header_position < header_size:
raise ZipImportError(f'bad central directory size: {archive!r}', path=archive)
if header_position < header_offset:
raise ZipImportError(f'bad central directory offset: {archive!r}', path=archive)
header_position -= header_size
arc_offset = header_position - header_offset
if arc_offset < 0:
raise ZipImportError(f'bad central directory size or offset: {archive!r}', path=archive)
files = {}
# Start of Central Directory
count = 0
try:
fp.seek(header_position)
except OSError:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
while True:
buffer = fp.read(46)
if len(buffer) < 4:
raise EOFError('EOF read where not expected')
# Start of file header
if buffer[:4] != b'PK\x01\x02':
break # Bad: Central Dir File Header
if len(buffer) != 46:
raise EOFError('EOF read where not expected')
flags = _unpack_uint16(buffer[8:10])
compress = _unpack_uint16(buffer[10:12])
time = _unpack_uint16(buffer[12:14])
date = _unpack_uint16(buffer[14:16])
crc = _unpack_uint32(buffer[16:20])
data_size = _unpack_uint32(buffer[20:24])
file_size = _unpack_uint32(buffer[24:28])
name_size = _unpack_uint16(buffer[28:30])
extra_size = _unpack_uint16(buffer[30:32])
comment_size = _unpack_uint16(buffer[32:34])
file_offset = _unpack_uint32(buffer[42:46])
header_size = name_size + extra_size + comment_size
if file_offset > header_offset:
raise ZipImportError(f'bad local header offset: {archive!r}', path=archive)
file_offset += arc_offset
try:
name = fp.read(name_size)
except OSError:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
if len(name) != name_size:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
# On Windows, calling fseek to skip over the fields we don't use is
# slower than reading the data because fseek flushes stdio's
# internal buffers. See issue #8745.
try:
if len(fp.read(header_size - name_size)) != header_size - name_size:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
except OSError:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
if flags & 0x800:
# UTF-8 file names extension
name = name.decode()
else:
# Historical ZIP filename encoding
try:
name = name.decode('ascii')
except UnicodeDecodeError:
name = name.decode('latin1').translate(cp437_table)
name = name.replace('/', path_sep)
path = _bootstrap_external._path_join(archive, name)
t = (path, compress, data_size, file_size, file_offset, time, date, crc)
files[name] = t
count += 1
_bootstrap._verbose_message('zipimport: found {} names in {!r}', count, archive)
return files
# During bootstrap, we may need to load the encodings
# package from a ZIP file. But the cp437 encoding is implemented
# in Python in the encodings package.
#
# Break out of this dependency by using the translation table for
# the cp437 encoding.
cp437_table = (
# ASCII part, 8 rows x 16 chars
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
'\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'
' !"#$%&\'()*+,-./'
'0123456789:;<=>?'
'@ABCDEFGHIJKLMNO'
'PQRSTUVWXYZ[\\]^_'
'`abcdefghijklmno'
'pqrstuvwxyz{|}~\x7f'
# non-ASCII part, 16 rows x 8 chars
'\xc7\xfc\xe9\xe2\xe4\xe0\xe5\xe7'
'\xea\xeb\xe8\xef\xee\xec\xc4\xc5'
'\xc9\xe6\xc6\xf4\xf6\xf2\xfb\xf9'
'\xff\xd6\xdc\xa2\xa3\xa5\u20a7\u0192'
'\xe1\xed\xf3\xfa\xf1\xd1\xaa\xba'
'\xbf\u2310\xac\xbd\xbc\xa1\xab\xbb'
'\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556'
'\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510'
'\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f'
'\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567'
'\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b'
'\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580'
'\u03b1\xdf\u0393\u03c0\u03a3\u03c3\xb5\u03c4'
'\u03a6\u0398\u03a9\u03b4\u221e\u03c6\u03b5\u2229'
'\u2261\xb1\u2265\u2264\u2320\u2321\xf7\u2248'
'\xb0\u2219\xb7\u221a\u207f\xb2\u25a0\xa0'
)
_importing_zlib = False
# Return the zlib.decompress function object, or NULL if zlib couldn't
# be imported. The function is cached when found, so subsequent calls
# don't import zlib again.
def _get_decompress_func():
global _importing_zlib
if _importing_zlib:
# Someone has a zlib.py[co] in their Zip file
# let's avoid a stack overflow.
_bootstrap._verbose_message('zipimport: zlib UNAVAILABLE')
raise ZipImportError("can't decompress data; zlib not available")
_importing_zlib = True
try:
from zlib import decompress
except Exception:
_bootstrap._verbose_message('zipimport: zlib UNAVAILABLE')
raise ZipImportError("can't decompress data; zlib not available")
finally:
_importing_zlib = False
_bootstrap._verbose_message('zipimport: zlib available')
return decompress
# Given a path to a Zip file and a toc_entry, return the (uncompressed) data.
def _get_data(archive, toc_entry):
datapath, compress, data_size, file_size, file_offset, time, date, crc = toc_entry
if data_size < 0:
raise ZipImportError('negative data size')
with _io.open(archive, 'rb') as fp:
# Check to make sure the local file header is correct
try:
fp.seek(file_offset)
except OSError:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
buffer = fp.read(30)
if len(buffer) != 30:
raise EOFError('EOF read where not expected')
if buffer[:4] != b'PK\x03\x04':
# Bad: Local File Header
raise ZipImportError(f'bad local file header: {archive!r}', path=archive)
name_size = _unpack_uint16(buffer[26:28])
extra_size = _unpack_uint16(buffer[28:30])
header_size = 30 + name_size + extra_size
file_offset += header_size # Start of file data
try:
fp.seek(file_offset)
except OSError:
raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
raw_data = fp.read(data_size)
if len(raw_data) != data_size:
raise OSError("zipimport: can't read data")
if compress == 0:
# data is not compressed
return raw_data
# Decompress with zlib
try:
decompress = _get_decompress_func()
except Exception:
raise ZipImportError("can't decompress data; zlib not available")
return decompress(raw_data, -15)
# Lenient date/time comparison function. The precision of the mtime
# in the archive is lower than the mtime stored in a .pyc: we
# must allow a difference of at most one second.
def _eq_mtime(t1, t2):
# dostime only stores even seconds, so be lenient
return abs(t1 - t2) <= 1
# Given the contents of a .py[co] file, unmarshal the data
# and return the code object. Return None if it the magic word doesn't
# match (we do this instead of raising an exception as we fall back
# to .py if available and we don't want to mask other errors).
def _unmarshal_code(pathname, data, mtime):
if len(data) < 16:
raise ZipImportError('bad pyc data')
if data[:4] != _bootstrap_external.MAGIC_NUMBER:
_bootstrap._verbose_message('{!r} has bad magic', pathname)
return None # signal caller to try alternative
flags = _unpack_uint32(data[4:8])
if flags != 0:
# Hash-based pyc. We currently refuse to handle checked hash-based
# pycs. We could validate hash-based pycs against the source, but it
# seems likely that most people putting hash-based pycs in a zipfile
# will use unchecked ones.
if (_imp.check_hash_based_pycs != 'never' and
(flags != 0x1 or _imp.check_hash_based_pycs == 'always')):
return None
elif mtime != 0 and not _eq_mtime(_unpack_uint32(data[8:12]), mtime):
_bootstrap._verbose_message('{!r} has bad mtime', pathname)
return None # signal caller to try alternative
# XXX the pyc's size field is ignored; timestamp collisions are probably
# unimportant with zip files.
code = marshal.loads(data[16:])
if not isinstance(code, _code_type):
raise TypeError(f'compiled module {pathname!r} is not a code object')
return code
_code_type = type(_unmarshal_code.__code__)
# Replace any occurrences of '\r\n?' in the input string with '\n'.
# This converts DOS and Mac line endings to Unix line endings.
def _normalize_line_endings(source):
source = source.replace(b'\r\n', b'\n')
source = source.replace(b'\r', b'\n')
return source
# Given a string buffer containing Python source code, compile it
# and return a code object.
def _compile_source(pathname, source):
source = _normalize_line_endings(source)
return compile(source, pathname, 'exec', dont_inherit=True)
# Convert the date/time values found in the Zip archive to a value
# that's compatible with the time stamp stored in .pyc files.
def _parse_dostime(d, t):
return time.mktime((
(d >> 9) + 1980, # bits 9..15: year
(d >> 5) & 0xF, # bits 5..8: month
d & 0x1F, # bits 0..4: day
t >> 11, # bits 11..15: hours
(t >> 5) & 0x3F, # bits 8..10: minutes
(t & 0x1F) * 2, # bits 0..7: seconds / 2
-1, -1, -1))
# Given a path to a .pyc file in the archive, return the
# modification time of the matching .py file, or 0 if no source
# is available.
def _get_mtime_of_source(self, path):
try:
# strip 'c' or 'o' from *.py[co]
assert path[-1:] in ('c', 'o')
path = path[:-1]
toc_entry = self._files[path]
# fetch the time stamp of the .py file for comparison
# with an embedded pyc time stamp
time = toc_entry[5]
date = toc_entry[6]
return _parse_dostime(date, time)
except (KeyError, IndexError, TypeError):
return 0
# Get the code object associated with the module specified by
# 'fullname'.
def _get_module_code(self, fullname):
path = _get_module_path(self, fullname)
for suffix, isbytecode, ispackage in _zip_searchorder:
fullpath = path + suffix
_bootstrap._verbose_message('trying {}{}{}', self.archive, path_sep, fullpath, verbosity=2)
try:
toc_entry = self._files[fullpath]
except KeyError:
pass
else:
modpath = toc_entry[0]
data = _get_data(self.archive, toc_entry)
if isbytecode:
mtime = _get_mtime_of_source(self, fullpath)
code = _unmarshal_code(modpath, data, mtime)
else:
code = _compile_source(modpath, data)
if code is None:
# bad magic number or non-matching mtime
# in byte code, try next
continue
modpath = toc_entry[0]
return code, ispackage, modpath
else:
raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
......@@ -713,16 +713,22 @@ Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FRO
regen-importlib: Programs/_freeze_importlib
# Regenerate Python/importlib_external.h
# from Lib/importlib/_bootstrap_external.py using _freeze_importlib
./Programs/_freeze_importlib \
./Programs/_freeze_importlib importlib._bootstrap_external \
$(srcdir)/Lib/importlib/_bootstrap_external.py \
$(srcdir)/Python/importlib_external.h.new
$(UPDATE_FILE) $(srcdir)/Python/importlib_external.h $(srcdir)/Python/importlib_external.h.new
# Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py
# using _freeze_importlib
./Programs/_freeze_importlib \
./Programs/_freeze_importlib importlib._bootstrap \
$(srcdir)/Lib/importlib/_bootstrap.py \
$(srcdir)/Python/importlib.h.new
$(UPDATE_FILE) $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib.h.new
# Regenerate Python/importlib_zipimport.h from Lib/zipimport.py
# using _freeze_importlib
./Programs/_freeze_importlib zipimport \
$(srcdir)/Lib/zipimport.py \
$(srcdir)/Python/importlib_zipimport.h.new
$(UPDATE_FILE) $(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/importlib_zipimport.h.new
############################################################################
......@@ -897,7 +903,8 @@ regen-opcode-targets:
Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h
Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h
Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h \
$(srcdir)/Python/importlib_zipimport.h
# Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to
# follow our naming conventions. dtrace(1) uses the output filename to generate
......
The :mod:`zipimport` module has been rewritten in pure Python.
......@@ -125,10 +125,6 @@ _locale _localemodule.c # -lintl
# Standard I/O baseline
_io -DPy_BUILD_CORE -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
# The zipimport module is always imported at startup. Having it as a
# builtin module avoids some bootstrapping problems and reduces overhead.
zipimport -DPy_BUILD_CORE zipimport.c
# faulthandler module
faulthandler faulthandler.c
......
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(zipimport_zipimporter___init____doc__,
"zipimporter(archivepath, /)\n"
"--\n"
"\n"
"Create a new zipimporter instance.\n"
"\n"
" archivepath\n"
" A path-like object to a zipfile, or to a specific path inside\n"
" a zipfile.\n"
"\n"
"\'archivepath\' must be a path-like object to a zipfile, or to a specific path\n"
"inside a zipfile. For example, it can be \'/tmp/myimport.zip\', or\n"
"\'/tmp/myimport.zip/mydirectory\', if mydirectory is a valid directory inside\n"
"the archive.\n"
"\n"
"\'ZipImportError\' is raised if \'archivepath\' doesn\'t point to a valid Zip\n"
"archive.\n"
"\n"
"The \'archive\' attribute of the zipimporter object contains the name of the\n"
"zipfile targeted.");
static int
zipimport_zipimporter___init___impl(ZipImporter *self, PyObject *path);
static int
zipimport_zipimporter___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
PyObject *path;
if ((Py_TYPE(self) == &ZipImporter_Type) &&
!_PyArg_NoKeywords("zipimporter", kwargs)) {
goto exit;
}
if (!PyArg_ParseTuple(args, "O&:zipimporter",
PyUnicode_FSDecoder, &path)) {
goto exit;
}
return_value = zipimport_zipimporter___init___impl((ZipImporter *)self, path);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_find_module__doc__,
"find_module($self, fullname, path=None, /)\n"
"--\n"
"\n"
"Search for a module specified by \'fullname\'.\n"
"\n"
"\'fullname\' must be the fully qualified (dotted) module name. It returns the\n"
"zipimporter instance itself if the module was found, or None if it wasn\'t.\n"
"The optional \'path\' argument is ignored -- it\'s there for compatibility\n"
"with the importer protocol.");
#define ZIPIMPORT_ZIPIMPORTER_FIND_MODULE_METHODDEF \
{"find_module", (PyCFunction)zipimport_zipimporter_find_module, METH_FASTCALL, zipimport_zipimporter_find_module__doc__},
static PyObject *
zipimport_zipimporter_find_module_impl(ZipImporter *self, PyObject *fullname,
PyObject *path);
static PyObject *
zipimport_zipimporter_find_module(ZipImporter *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *fullname;
PyObject *path = Py_None;
if (!_PyArg_ParseStack(args, nargs, "U|O:find_module",
&fullname, &path)) {
goto exit;
}
return_value = zipimport_zipimporter_find_module_impl(self, fullname, path);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_find_loader__doc__,
"find_loader($self, fullname, path=None, /)\n"
"--\n"
"\n"
"Search for a module specified by \'fullname\'.\n"
"\n"
"\'fullname\' must be the fully qualified (dotted) module name. It returns the\n"
"zipimporter instance itself if the module was found, a string containing the\n"
"full path name if it\'s possibly a portion of a namespace package,\n"
"or None otherwise. The optional \'path\' argument is ignored -- it\'s\n"
"there for compatibility with the importer protocol.");
#define ZIPIMPORT_ZIPIMPORTER_FIND_LOADER_METHODDEF \
{"find_loader", (PyCFunction)zipimport_zipimporter_find_loader, METH_FASTCALL, zipimport_zipimporter_find_loader__doc__},
static PyObject *
zipimport_zipimporter_find_loader_impl(ZipImporter *self, PyObject *fullname,
PyObject *path);
static PyObject *
zipimport_zipimporter_find_loader(ZipImporter *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *fullname;
PyObject *path = Py_None;
if (!_PyArg_ParseStack(args, nargs, "U|O:find_loader",
&fullname, &path)) {
goto exit;
}
return_value = zipimport_zipimporter_find_loader_impl(self, fullname, path);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_load_module__doc__,
"load_module($self, fullname, /)\n"
"--\n"
"\n"
"Load the module specified by \'fullname\'.\n"
"\n"
"\'fullname\' must be the fully qualified (dotted) module name. It returns the\n"
"imported module, or raises ZipImportError if it wasn\'t found.");
#define ZIPIMPORT_ZIPIMPORTER_LOAD_MODULE_METHODDEF \
{"load_module", (PyCFunction)zipimport_zipimporter_load_module, METH_O, zipimport_zipimporter_load_module__doc__},
static PyObject *
zipimport_zipimporter_load_module_impl(ZipImporter *self, PyObject *fullname);
static PyObject *
zipimport_zipimporter_load_module(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *fullname;
if (!PyArg_Parse(arg, "U:load_module", &fullname)) {
goto exit;
}
return_value = zipimport_zipimporter_load_module_impl(self, fullname);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_get_filename__doc__,
"get_filename($self, fullname, /)\n"
"--\n"
"\n"
"Return the filename for the specified module.");
#define ZIPIMPORT_ZIPIMPORTER_GET_FILENAME_METHODDEF \
{"get_filename", (PyCFunction)zipimport_zipimporter_get_filename, METH_O, zipimport_zipimporter_get_filename__doc__},
static PyObject *
zipimport_zipimporter_get_filename_impl(ZipImporter *self,
PyObject *fullname);
static PyObject *
zipimport_zipimporter_get_filename(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *fullname;
if (!PyArg_Parse(arg, "U:get_filename", &fullname)) {
goto exit;
}
return_value = zipimport_zipimporter_get_filename_impl(self, fullname);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_is_package__doc__,
"is_package($self, fullname, /)\n"
"--\n"
"\n"
"Return True if the module specified by fullname is a package.\n"
"\n"
"Raise ZipImportError if the module couldn\'t be found.");
#define ZIPIMPORT_ZIPIMPORTER_IS_PACKAGE_METHODDEF \
{"is_package", (PyCFunction)zipimport_zipimporter_is_package, METH_O, zipimport_zipimporter_is_package__doc__},
static PyObject *
zipimport_zipimporter_is_package_impl(ZipImporter *self, PyObject *fullname);
static PyObject *
zipimport_zipimporter_is_package(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *fullname;
if (!PyArg_Parse(arg, "U:is_package", &fullname)) {
goto exit;
}
return_value = zipimport_zipimporter_is_package_impl(self, fullname);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_get_data__doc__,
"get_data($self, pathname, /)\n"
"--\n"
"\n"
"Return the data associated with \'pathname\'.\n"
"\n"
"Raise OSError if the file was not found.");
#define ZIPIMPORT_ZIPIMPORTER_GET_DATA_METHODDEF \
{"get_data", (PyCFunction)zipimport_zipimporter_get_data, METH_O, zipimport_zipimporter_get_data__doc__},
static PyObject *
zipimport_zipimporter_get_data_impl(ZipImporter *self, PyObject *path);
static PyObject *
zipimport_zipimporter_get_data(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *path;
if (!PyArg_Parse(arg, "U:get_data", &path)) {
goto exit;
}
return_value = zipimport_zipimporter_get_data_impl(self, path);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_get_code__doc__,
"get_code($self, fullname, /)\n"
"--\n"
"\n"
"Return the code object for the specified module.\n"
"\n"
"Raise ZipImportError if the module couldn\'t be found.");
#define ZIPIMPORT_ZIPIMPORTER_GET_CODE_METHODDEF \
{"get_code", (PyCFunction)zipimport_zipimporter_get_code, METH_O, zipimport_zipimporter_get_code__doc__},
static PyObject *
zipimport_zipimporter_get_code_impl(ZipImporter *self, PyObject *fullname);
static PyObject *
zipimport_zipimporter_get_code(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *fullname;
if (!PyArg_Parse(arg, "U:get_code", &fullname)) {
goto exit;
}
return_value = zipimport_zipimporter_get_code_impl(self, fullname);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_get_source__doc__,
"get_source($self, fullname, /)\n"
"--\n"
"\n"
"Return the source code for the specified module.\n"
"\n"
"Raise ZipImportError if the module couldn\'t be found, return None if the\n"
"archive does contain the module, but has no source for it.");
#define ZIPIMPORT_ZIPIMPORTER_GET_SOURCE_METHODDEF \
{"get_source", (PyCFunction)zipimport_zipimporter_get_source, METH_O, zipimport_zipimporter_get_source__doc__},
static PyObject *
zipimport_zipimporter_get_source_impl(ZipImporter *self, PyObject *fullname);
static PyObject *
zipimport_zipimporter_get_source(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *fullname;
if (!PyArg_Parse(arg, "U:get_source", &fullname)) {
goto exit;
}
return_value = zipimport_zipimporter_get_source_impl(self, fullname);
exit:
return return_value;
}
PyDoc_STRVAR(zipimport_zipimporter_get_resource_reader__doc__,
"get_resource_reader($self, fullname, /)\n"
"--\n"
"\n"
"Return the ResourceReader for a package in a zip file.\n"
"\n"
"If \'fullname\' is a package within the zip file, return the \'ResourceReader\'\n"
"object for the package. Otherwise return None.");
#define ZIPIMPORT_ZIPIMPORTER_GET_RESOURCE_READER_METHODDEF \
{"get_resource_reader", (PyCFunction)zipimport_zipimporter_get_resource_reader, METH_O, zipimport_zipimporter_get_resource_reader__doc__},
static PyObject *
zipimport_zipimporter_get_resource_reader_impl(ZipImporter *self,
PyObject *fullname);
static PyObject *
zipimport_zipimporter_get_resource_reader(ZipImporter *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *fullname;
if (!PyArg_Parse(arg, "U:get_resource_reader", &fullname)) {
goto exit;
}
return_value = zipimport_zipimporter_get_resource_reader_impl(self, fullname);
exit:
return return_value;
}
/*[clinic end generated code: output=0b57adfe21373512 input=a9049054013a1b77]*/
#include "Python.h"
#include "internal/pystate.h"
#include "structmember.h"
#include "osdefs.h"
#include "marshal.h"
#include <time.h>
#define IS_SOURCE 0x0
#define IS_BYTECODE 0x1
#define IS_PACKAGE 0x2
struct st_zip_searchorder {
char suffix[14];
int type;
};
#ifdef ALTSEP
_Py_IDENTIFIER(replace);
#endif
/* zip_searchorder defines how we search for a module in the Zip
archive: we first search for a package __init__, then for
non-package .pyc, and .py entries. The .pyc entries
are swapped by initzipimport() if we run in optimized mode. Also,
'/' is replaced by SEP there. */
static struct st_zip_searchorder zip_searchorder[] = {
{"/__init__.pyc", IS_PACKAGE | IS_BYTECODE},
{"/__init__.py", IS_PACKAGE | IS_SOURCE},
{".pyc", IS_BYTECODE},
{".py", IS_SOURCE},
{"", 0}
};
/* zipimporter object definition and support */
typedef struct _zipimporter ZipImporter;
struct _zipimporter {
PyObject_HEAD
PyObject *archive; /* pathname of the Zip archive,
decoded from the filesystem encoding */
PyObject *prefix; /* file prefix: "a/sub/directory/",
encoded to the filesystem encoding */
PyObject *files; /* dict with file info {path: toc_entry} */
};
static PyObject *ZipImportError;
/* read_directory() cache */
static PyObject *zip_directory_cache = NULL;
/* forward decls */
static PyObject *read_directory(PyObject *archive);
static PyObject *get_data(PyObject *archive, PyObject *toc_entry);
static PyObject *get_module_code(ZipImporter *self, PyObject *fullname,
int *p_ispackage, PyObject **p_modpath);
static PyTypeObject ZipImporter_Type;
#define ZipImporter_Check(op) PyObject_TypeCheck(op, &ZipImporter_Type)
/*[clinic input]
module zipimport
class zipimport.zipimporter "ZipImporter *" "&ZipImporter_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=9db8b61557d911e7]*/
#include "clinic/zipimport.c.h"
/* zipimporter.__init__
Split the "subdirectory" from the Zip archive path, lookup a matching
entry in sys.path_importer_cache, fetch the file directory from there
if found, or else read it from the archive. */
/*[clinic input]
zipimport.zipimporter.__init__
archivepath as path: object(converter="PyUnicode_FSDecoder")
A path-like object to a zipfile, or to a specific path inside
a zipfile.
/
Create a new zipimporter instance.
'archivepath' must be a path-like object to a zipfile, or to a specific path
inside a zipfile. For example, it can be '/tmp/myimport.zip', or
'/tmp/myimport.zip/mydirectory', if mydirectory is a valid directory inside
the archive.
'ZipImportError' is raised if 'archivepath' doesn't point to a valid Zip
archive.
The 'archive' attribute of the zipimporter object contains the name of the
zipfile targeted.
[clinic start generated code]*/
static int
zipimport_zipimporter___init___impl(ZipImporter *self, PyObject *path)
/*[clinic end generated code: output=141558fefdb46dc8 input=92b9ebeed1f6a704]*/
{
PyObject *files, *tmp;
PyObject *filename = NULL;
Py_ssize_t len, flen;
if (PyUnicode_READY(path) == -1)
return -1;
len = PyUnicode_GET_LENGTH(path);
if (len == 0) {
PyErr_SetString(ZipImportError, "archive path is empty");
goto error;
}
#ifdef ALTSEP
tmp = _PyObject_CallMethodId(path, &PyId_replace, "CC", ALTSEP, SEP);
if (!tmp)
goto error;
Py_DECREF(path);
path = tmp;
#endif
filename = path;
Py_INCREF(filename);
flen = len;
for (;;) {
struct stat statbuf;
int rv;
rv = _Py_stat(filename, &statbuf);
if (rv == -2)
goto error;
if (rv == 0) {
/* it exists */
if (!S_ISREG(statbuf.st_mode))
/* it's a not file */
Py_CLEAR(filename);
break;
}
Py_CLEAR(filename);
/* back up one path element */
flen = PyUnicode_FindChar(path, SEP, 0, flen, -1);
if (flen == -1)
break;
filename = PyUnicode_Substring(path, 0, flen);
if (filename == NULL)
goto error;
}
if (filename == NULL) {
PyErr_SetString(ZipImportError, "not a Zip file");
goto error;
}
if (PyUnicode_READY(filename) < 0)
goto error;
files = PyDict_GetItem(zip_directory_cache, filename);
if (files == NULL) {
files = read_directory(filename);
if (files == NULL)
goto error;
if (PyDict_SetItem(zip_directory_cache, filename, files) != 0)
goto error;
}
else
Py_INCREF(files);
Py_XSETREF(self->files, files);
/* Transfer reference */
Py_XSETREF(self->archive, filename);
filename = NULL;
/* Check if there is a prefix directory following the filename. */
if (flen != len) {
tmp = PyUnicode_Substring(path, flen+1,
PyUnicode_GET_LENGTH(path));
if (tmp == NULL)
goto error;
Py_XSETREF(self->prefix, tmp);
if (PyUnicode_READ_CHAR(path, len-1) != SEP) {
/* add trailing SEP */
tmp = PyUnicode_FromFormat("%U%c", self->prefix, SEP);
if (tmp == NULL)
goto error;
Py_SETREF(self->prefix, tmp);
}
}
else {
Py_XSETREF(self->prefix, PyUnicode_New(0, 0));
}
Py_DECREF(path);
return 0;
error:
Py_DECREF(path);
Py_XDECREF(filename);
return -1;
}
/* GC support. */
static int
zipimporter_traverse(PyObject *obj, visitproc visit, void *arg)
{
ZipImporter *self = (ZipImporter *)obj;
Py_VISIT(self->files);
return 0;
}
static void
zipimporter_dealloc(ZipImporter *self)
{
PyObject_GC_UnTrack(self);
Py_XDECREF(self->archive);
Py_XDECREF(self->prefix);
Py_XDECREF(self->files);
Py_TYPE(self)->tp_free((PyObject *)self);
}
static PyObject *
zipimporter_repr(ZipImporter *self)
{
if (self->archive == NULL)
return PyUnicode_FromString("<zipimporter object \"???\">");
else if (self->prefix != NULL && PyUnicode_GET_LENGTH(self->prefix) != 0)
return PyUnicode_FromFormat("<zipimporter object \"%U%c%U\">",
self->archive, SEP, self->prefix);
else
return PyUnicode_FromFormat("<zipimporter object \"%U\">",
self->archive);
}
/* return fullname.split(".")[-1] */
static PyObject *
get_subname(PyObject *fullname)
{
Py_ssize_t len, dot;
if (PyUnicode_READY(fullname) < 0)
return NULL;
len = PyUnicode_GET_LENGTH(fullname);
dot = PyUnicode_FindChar(fullname, '.', 0, len, -1);
if (dot == -1) {
Py_INCREF(fullname);
return fullname;
} else
return PyUnicode_Substring(fullname, dot+1, len);
}
/* Given a (sub)modulename, write the potential file path in the
archive (without extension) to the path buffer. Return the
length of the resulting string.
return self.prefix + name.replace('.', os.sep) */
static PyObject*
make_filename(PyObject *prefix, PyObject *name)
{
PyObject *pathobj;
Py_UCS4 *p, *buf;
Py_ssize_t len;
len = PyUnicode_GET_LENGTH(prefix) + PyUnicode_GET_LENGTH(name) + 1;
p = buf = PyMem_New(Py_UCS4, len);
if (buf == NULL) {
PyErr_NoMemory();
return NULL;
}
if (!PyUnicode_AsUCS4(prefix, p, len, 0)) {
PyMem_Free(buf);
return NULL;
}
p += PyUnicode_GET_LENGTH(prefix);
len -= PyUnicode_GET_LENGTH(prefix);
if (!PyUnicode_AsUCS4(name, p, len, 1)) {
PyMem_Free(buf);
return NULL;
}
for (; *p; p++) {
if (*p == '.')
*p = SEP;
}
pathobj = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND,
buf, p-buf);
PyMem_Free(buf);
return pathobj;
}
enum zi_module_info {
MI_ERROR,
MI_NOT_FOUND,
MI_MODULE,
MI_PACKAGE
};
/* Does this path represent a directory?
on error, return < 0
if not a dir, return 0
if a dir, return 1
*/
static int
check_is_directory(ZipImporter *self, PyObject* prefix, PyObject *path)
{
PyObject *dirpath;
int res;
/* See if this is a "directory". If so, it's eligible to be part
of a namespace package. We test by seeing if the name, with an
appended path separator, exists. */
dirpath = PyUnicode_FromFormat("%U%U%c", prefix, path, SEP);
if (dirpath == NULL)
return -1;
/* If dirpath is present in self->files, we have a directory. */
res = PyDict_Contains(self->files, dirpath);
Py_DECREF(dirpath);
return res;
}
/* Return some information about a module. */
static enum zi_module_info
get_module_info(ZipImporter *self, PyObject *fullname)
{
PyObject *subname;
PyObject *path, *fullpath, *item;
struct st_zip_searchorder *zso;
if (self->prefix == NULL) {
PyErr_SetString(PyExc_ValueError,
"zipimporter.__init__() wasn't called");
return MI_ERROR;
}
subname = get_subname(fullname);
if (subname == NULL)
return MI_ERROR;
path = make_filename(self->prefix, subname);
Py_DECREF(subname);
if (path == NULL)
return MI_ERROR;
for (zso = zip_searchorder; *zso->suffix; zso++) {
fullpath = PyUnicode_FromFormat("%U%s", path, zso->suffix);
if (fullpath == NULL) {
Py_DECREF(path);
return MI_ERROR;
}
item = PyDict_GetItem(self->files, fullpath);
Py_DECREF(fullpath);
if (item != NULL) {
Py_DECREF(path);
if (zso->type & IS_PACKAGE)
return MI_PACKAGE;
else
return MI_MODULE;
}
}
Py_DECREF(path);
return MI_NOT_FOUND;
}
typedef enum {
FL_ERROR = -1, /* error */
FL_NOT_FOUND, /* no loader or namespace portions found */
FL_MODULE_FOUND, /* module/package found */
FL_NS_FOUND /* namespace portion found: */
/* *namespace_portion will point to the name */
} find_loader_result;
/* The guts of "find_loader" and "find_module".
*/
static find_loader_result
find_loader(ZipImporter *self, PyObject *fullname, PyObject **namespace_portion)
{
enum zi_module_info mi;
*namespace_portion = NULL;
mi = get_module_info(self, fullname);
if (mi == MI_ERROR)
return FL_ERROR;
if (mi == MI_NOT_FOUND) {
/* Not a module or regular package. See if this is a directory, and
therefore possibly a portion of a namespace package. */
find_loader_result result = FL_NOT_FOUND;
PyObject *subname;
int is_dir;
/* We're only interested in the last path component of fullname;
earlier components are recorded in self->prefix. */
subname = get_subname(fullname);
if (subname == NULL) {
return FL_ERROR;
}
is_dir = check_is_directory(self, self->prefix, subname);
if (is_dir < 0)
result = FL_ERROR;
else if (is_dir) {
/* This is possibly a portion of a namespace
package. Return the string representing its path,
without a trailing separator. */
*namespace_portion = PyUnicode_FromFormat("%U%c%U%U",
self->archive, SEP,
self->prefix, subname);
if (*namespace_portion == NULL)
result = FL_ERROR;
else
result = FL_NS_FOUND;
}
Py_DECREF(subname);
return result;
}
/* This is a module or package. */
return FL_MODULE_FOUND;
}
/*[clinic input]
zipimport.zipimporter.find_module
fullname: unicode
path: object = None
/
Search for a module specified by 'fullname'.
'fullname' must be the fully qualified (dotted) module name. It returns the
zipimporter instance itself if the module was found, or None if it wasn't.
The optional 'path' argument is ignored -- it's there for compatibility
with the importer protocol.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_find_module_impl(ZipImporter *self, PyObject *fullname,
PyObject *path)
/*[clinic end generated code: output=506087f609466dc7 input=e3528520e075063f]*/
{
PyObject *namespace_portion = NULL;
PyObject *result = NULL;
switch (find_loader(self, fullname, &namespace_portion)) {
case FL_ERROR:
return NULL;
case FL_NS_FOUND:
/* A namespace portion is not allowed via find_module, so return None. */
Py_DECREF(namespace_portion);
/* FALL THROUGH */
case FL_NOT_FOUND:
result = Py_None;
break;
case FL_MODULE_FOUND:
result = (PyObject *)self;
break;
default:
PyErr_BadInternalCall();
return NULL;
}
Py_INCREF(result);
return result;
}
/*[clinic input]
zipimport.zipimporter.find_loader
fullname: unicode
path: object = None
/
Search for a module specified by 'fullname'.
'fullname' must be the fully qualified (dotted) module name. It returns the
zipimporter instance itself if the module was found, a string containing the
full path name if it's possibly a portion of a namespace package,
or None otherwise. The optional 'path' argument is ignored -- it's
there for compatibility with the importer protocol.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_find_loader_impl(ZipImporter *self, PyObject *fullname,
PyObject *path)
/*[clinic end generated code: output=601599a43bc0f49a input=dc73f275b0d5be23]*/
{
PyObject *result = NULL;
PyObject *namespace_portion = NULL;
switch (find_loader(self, fullname, &namespace_portion)) {
case FL_ERROR:
return NULL;
case FL_NOT_FOUND: /* Not found, return (None, []) */
result = Py_BuildValue("O[]", Py_None);
break;
case FL_MODULE_FOUND: /* Return (self, []) */
result = Py_BuildValue("O[]", self);
break;
case FL_NS_FOUND: /* Return (None, [namespace_portion]) */
result = Py_BuildValue("O[O]", Py_None, namespace_portion);
Py_DECREF(namespace_portion);
return result;
default:
PyErr_BadInternalCall();
return NULL;
}
return result;
}
/*[clinic input]
zipimport.zipimporter.load_module
fullname: unicode
/
Load the module specified by 'fullname'.
'fullname' must be the fully qualified (dotted) module name. It returns the
imported module, or raises ZipImportError if it wasn't found.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_load_module_impl(ZipImporter *self, PyObject *fullname)
/*[clinic end generated code: output=7303cebf88d47953 input=c236e2e8621f04ef]*/
{
PyObject *code = NULL, *mod, *dict;
PyObject *modpath = NULL;
int ispackage;
if (PyUnicode_READY(fullname) == -1)
return NULL;
code = get_module_code(self, fullname, &ispackage, &modpath);
if (code == NULL)
goto error;
mod = PyImport_AddModuleObject(fullname);
if (mod == NULL)
goto error;
dict = PyModule_GetDict(mod);
/* mod.__loader__ = self */
if (PyDict_SetItemString(dict, "__loader__", (PyObject *)self) != 0)
goto error;
if (ispackage) {
/* add __path__ to the module *before* the code gets
executed */
PyObject *pkgpath, *fullpath, *subname;
int err;
subname = get_subname(fullname);
if (subname == NULL)
goto error;
fullpath = PyUnicode_FromFormat("%U%c%U%U",
self->archive, SEP,
self->prefix, subname);
Py_DECREF(subname);
if (fullpath == NULL)
goto error;
pkgpath = Py_BuildValue("[N]", fullpath);
if (pkgpath == NULL)
goto error;
err = PyDict_SetItemString(dict, "__path__", pkgpath);
Py_DECREF(pkgpath);
if (err != 0)
goto error;
}
mod = PyImport_ExecCodeModuleObject(fullname, code, modpath, NULL);
Py_CLEAR(code);
if (mod == NULL)
goto error;
if (Py_VerboseFlag)
PySys_FormatStderr("import %U # loaded from Zip %U\n",
fullname, modpath);
Py_DECREF(modpath);
return mod;
error:
Py_XDECREF(code);
Py_XDECREF(modpath);
return NULL;
}
/*[clinic input]
zipimport.zipimporter.get_filename
fullname: unicode
/
Return the filename for the specified module.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_get_filename_impl(ZipImporter *self,
PyObject *fullname)
/*[clinic end generated code: output=c5b92b58bea86506 input=28d2eb57e4f25c8a]*/
{
PyObject *code, *modpath;
int ispackage;
/* Deciding the filename requires working out where the code
would come from if the module was actually loaded */
code = get_module_code(self, fullname, &ispackage, &modpath);
if (code == NULL)
return NULL;
Py_DECREF(code); /* Only need the path info */
return modpath;
}
/*[clinic input]
zipimport.zipimporter.is_package
fullname: unicode
/
Return True if the module specified by fullname is a package.
Raise ZipImportError if the module couldn't be found.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_is_package_impl(ZipImporter *self, PyObject *fullname)
/*[clinic end generated code: output=c32958c2a5216ae6 input=a7ba752f64345062]*/
{
enum zi_module_info mi;
mi = get_module_info(self, fullname);
if (mi == MI_ERROR)
return NULL;
if (mi == MI_NOT_FOUND) {
PyErr_Format(ZipImportError, "can't find module %R", fullname);
return NULL;
}
return PyBool_FromLong(mi == MI_PACKAGE);
}
/*[clinic input]
zipimport.zipimporter.get_data
pathname as path: unicode
/
Return the data associated with 'pathname'.
Raise OSError if the file was not found.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_get_data_impl(ZipImporter *self, PyObject *path)
/*[clinic end generated code: output=65dc506aaa268436 input=fa6428b74843c4ae]*/
{
PyObject *key;
PyObject *toc_entry;
Py_ssize_t path_start, path_len, len;
if (self->archive == NULL) {
PyErr_SetString(PyExc_ValueError,
"zipimporter.__init__() wasn't called");
return NULL;
}
#ifdef ALTSEP
path = _PyObject_CallMethodId((PyObject *)&PyUnicode_Type, &PyId_replace,
"OCC", path, ALTSEP, SEP);
if (!path)
return NULL;
#else
Py_INCREF(path);
#endif
if (PyUnicode_READY(path) == -1)
goto error;
path_len = PyUnicode_GET_LENGTH(path);
len = PyUnicode_GET_LENGTH(self->archive);
path_start = 0;
if (PyUnicode_Tailmatch(path, self->archive, 0, len, -1)
&& PyUnicode_READ_CHAR(path, len) == SEP) {
path_start = len + 1;
}
key = PyUnicode_Substring(path, path_start, path_len);
if (key == NULL)
goto error;
toc_entry = PyDict_GetItem(self->files, key);
if (toc_entry == NULL) {
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, key);
Py_DECREF(key);
goto error;
}
Py_DECREF(key);
Py_DECREF(path);
return get_data(self->archive, toc_entry);
error:
Py_DECREF(path);
return NULL;
}
/*[clinic input]
zipimport.zipimporter.get_code
fullname: unicode
/
Return the code object for the specified module.
Raise ZipImportError if the module couldn't be found.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_get_code_impl(ZipImporter *self, PyObject *fullname)
/*[clinic end generated code: output=b923c37fa99cbac4 input=2761412bc37f3549]*/
{
return get_module_code(self, fullname, NULL, NULL);
}
/*[clinic input]
zipimport.zipimporter.get_source
fullname: unicode
/
Return the source code for the specified module.
Raise ZipImportError if the module couldn't be found, return None if the
archive does contain the module, but has no source for it.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_get_source_impl(ZipImporter *self, PyObject *fullname)
/*[clinic end generated code: output=bc059301b0c33729 input=4e4b186f2e690716]*/
{
PyObject *toc_entry;
PyObject *subname, *path, *fullpath;
enum zi_module_info mi;
mi = get_module_info(self, fullname);
if (mi == MI_ERROR)
return NULL;
if (mi == MI_NOT_FOUND) {
PyErr_Format(ZipImportError, "can't find module %R", fullname);
return NULL;
}
subname = get_subname(fullname);
if (subname == NULL)
return NULL;
path = make_filename(self->prefix, subname);
Py_DECREF(subname);
if (path == NULL)
return NULL;
if (mi == MI_PACKAGE)
fullpath = PyUnicode_FromFormat("%U%c__init__.py", path, SEP);
else
fullpath = PyUnicode_FromFormat("%U.py", path);
Py_DECREF(path);
if (fullpath == NULL)
return NULL;
toc_entry = PyDict_GetItem(self->files, fullpath);
Py_DECREF(fullpath);
if (toc_entry != NULL) {
PyObject *res, *bytes;
bytes = get_data(self->archive, toc_entry);
if (bytes == NULL)
return NULL;
res = PyUnicode_FromStringAndSize(PyBytes_AS_STRING(bytes),
PyBytes_GET_SIZE(bytes));
Py_DECREF(bytes);
return res;
}
/* we have the module, but no source */
Py_RETURN_NONE;
}
/*[clinic input]
zipimport.zipimporter.get_resource_reader
fullname: unicode
/
Return the ResourceReader for a package in a zip file.
If 'fullname' is a package within the zip file, return the 'ResourceReader'
object for the package. Otherwise return None.
[clinic start generated code]*/
static PyObject *
zipimport_zipimporter_get_resource_reader_impl(ZipImporter *self,
PyObject *fullname)
/*[clinic end generated code: output=5e367d431f830726 input=bfab94d736e99151]*/
{
PyObject *module = PyImport_ImportModule("importlib.resources");
if (module == NULL) {
return NULL;
}
PyObject *retval = PyObject_CallMethod(
module, "_zipimport_get_resource_reader",
"OO", (PyObject *)self, fullname);
Py_DECREF(module);
return retval;
}
static PyMethodDef zipimporter_methods[] = {
ZIPIMPORT_ZIPIMPORTER_FIND_MODULE_METHODDEF
ZIPIMPORT_ZIPIMPORTER_FIND_LOADER_METHODDEF
ZIPIMPORT_ZIPIMPORTER_LOAD_MODULE_METHODDEF
ZIPIMPORT_ZIPIMPORTER_GET_FILENAME_METHODDEF
ZIPIMPORT_ZIPIMPORTER_IS_PACKAGE_METHODDEF
ZIPIMPORT_ZIPIMPORTER_GET_DATA_METHODDEF
ZIPIMPORT_ZIPIMPORTER_GET_CODE_METHODDEF
ZIPIMPORT_ZIPIMPORTER_GET_SOURCE_METHODDEF
ZIPIMPORT_ZIPIMPORTER_GET_RESOURCE_READER_METHODDEF
{NULL, NULL} /* sentinel */
};
static PyMemberDef zipimporter_members[] = {
{"archive", T_OBJECT, offsetof(ZipImporter, archive), READONLY},
{"prefix", T_OBJECT, offsetof(ZipImporter, prefix), READONLY},
{"_files", T_OBJECT, offsetof(ZipImporter, files), READONLY},
{NULL}
};
#define DEFERRED_ADDRESS(ADDR) 0
static PyTypeObject ZipImporter_Type = {
PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0)
"zipimport.zipimporter",
sizeof(ZipImporter),
0, /* tp_itemsize */
(destructor)zipimporter_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
(reprfunc)zipimporter_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_HAVE_GC, /* tp_flags */
zipimport_zipimporter___init____doc__, /* tp_doc */
zipimporter_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
zipimporter_methods, /* tp_methods */
zipimporter_members, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)zipimport_zipimporter___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
PyType_GenericNew, /* tp_new */
PyObject_GC_Del, /* tp_free */
};
/* implementation */
/* Given a buffer, return the unsigned int that is represented by the first
4 bytes, encoded as little endian. This partially reimplements
marshal.c:r_long() */
static unsigned int
get_uint32(const unsigned char *buf)
{
unsigned int x;
x = buf[0];
x |= (unsigned int)buf[1] << 8;
x |= (unsigned int)buf[2] << 16;
x |= (unsigned int)buf[3] << 24;
return x;
}
/* Given a buffer, return the unsigned int that is represented by the first
2 bytes, encoded as little endian. This partially reimplements
marshal.c:r_short() */
static unsigned short
get_uint16(const unsigned char *buf)
{
unsigned short x;
x = buf[0];
x |= (unsigned short)buf[1] << 8;
return x;
}
static void
set_file_error(PyObject *archive, int eof)
{
if (eof) {
PyErr_SetString(PyExc_EOFError, "EOF read where not expected");
}
else {
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, archive);
}
}
/*
read_directory(archive) -> files dict (new reference)
Given a path to a Zip archive, build a dict, mapping file names
(local to the archive, using SEP as a separator) to toc entries.
A toc_entry is a tuple:
(__file__, # value to use for __file__, available for all files,
# encoded to the filesystem encoding
compress, # compression kind; 0 for uncompressed
data_size, # size of compressed data on disk
file_size, # size of decompressed data
file_offset, # offset of file header from start of archive
time, # mod time of file (in dos format)
date, # mod data of file (in dos format)
crc, # crc checksum of the data
)
Directories can be recognized by the trailing SEP in the name,
data_size and file_offset are 0.
*/
static PyObject *
read_directory(PyObject *archive)
{
PyObject *files = NULL;
FILE *fp;
unsigned short flags, compress, time, date, name_size;
unsigned int crc, data_size, file_size, header_size, header_offset;
unsigned long file_offset, header_position;
unsigned long arc_offset; /* Absolute offset to start of the zip-archive. */
unsigned int count, i;
unsigned char buffer[46];
char name[MAXPATHLEN + 5];
PyObject *nameobj = NULL;
PyObject *path;
const char *charset;
int bootstrap;
const char *errmsg = NULL;
fp = _Py_fopen_obj(archive, "rb");
if (fp == NULL) {
if (PyErr_ExceptionMatches(PyExc_OSError)) {
_PyErr_FormatFromCause(ZipImportError,
"can't open Zip file: %R", archive);
}
return NULL;
}
if (fseek(fp, -22, SEEK_END) == -1) {
goto file_error;
}
header_position = (unsigned long)ftell(fp);
if (header_position == (unsigned long)-1) {
goto file_error;
}
assert(header_position <= (unsigned long)LONG_MAX);
if (fread(buffer, 1, 22, fp) != 22) {
goto file_error;
}
if (get_uint32(buffer) != 0x06054B50u) {
/* Bad: End of Central Dir signature */
errmsg = "not a Zip file";
goto invalid_header;
}
header_size = get_uint32(buffer + 12);
header_offset = get_uint32(buffer + 16);
if (header_position < header_size) {
errmsg = "bad central directory size";
goto invalid_header;
}
if (header_position < header_offset) {
errmsg = "bad central directory offset";
goto invalid_header;
}
if (header_position - header_size < header_offset) {
errmsg = "bad central directory size or offset";
goto invalid_header;
}
header_position -= header_size;
arc_offset = header_position - header_offset;
files = PyDict_New();
if (files == NULL) {
goto error;
}
/* Start of Central Directory */
count = 0;
if (fseek(fp, (long)header_position, 0) == -1) {
goto file_error;
}
for (;;) {
PyObject *t;
size_t n;
int err;
n = fread(buffer, 1, 46, fp);
if (n < 4) {
goto eof_error;
}
/* Start of file header */
if (get_uint32(buffer) != 0x02014B50u) {
break; /* Bad: Central Dir File Header */
}
if (n != 46) {
goto eof_error;
}
flags = get_uint16(buffer + 8);
compress = get_uint16(buffer + 10);
time = get_uint16(buffer + 12);
date = get_uint16(buffer + 14);
crc = get_uint32(buffer + 16);
data_size = get_uint32(buffer + 20);
file_size = get_uint32(buffer + 24);
name_size = get_uint16(buffer + 28);
header_size = (unsigned int)name_size +
get_uint16(buffer + 30) /* extra field */ +
get_uint16(buffer + 32) /* comment */;
file_offset = get_uint32(buffer + 42);
if (file_offset > header_offset) {
errmsg = "bad local header offset";
goto invalid_header;
}
file_offset += arc_offset;
if (name_size > MAXPATHLEN) {
name_size = MAXPATHLEN;
}
if (fread(name, 1, name_size, fp) != name_size) {
goto file_error;
}
name[name_size] = '\0'; /* Add terminating null byte */
#if SEP != '/'
for (i = 0; i < name_size; i++) {
if (name[i] == '/') {
name[i] = SEP;
}
}
#endif
/* Skip the rest of the header.
* On Windows, calling fseek to skip over the fields we don't use is
* slower than reading the data because fseek flushes stdio's
* internal buffers. See issue #8745. */
assert(header_size <= 3*0xFFFFu);
for (i = name_size; i < header_size; i++) {
if (getc(fp) == EOF) {
goto file_error;
}
}
bootstrap = 0;
if (flags & 0x0800) {
charset = "utf-8";
}
else if (!_PyInterpreterState_Get()->codecs_initialized) {
/* During bootstrap, we may need to load the encodings
package from a ZIP file. But the cp437 encoding is implemented
in Python in the encodings package.
Break out of this dependency by assuming that the path to
the encodings module is ASCII-only. */
charset = "ascii";
bootstrap = 1;
}
else {
charset = "cp437";
}
nameobj = PyUnicode_Decode(name, name_size, charset, NULL);
if (nameobj == NULL) {
if (bootstrap) {
PyErr_Format(PyExc_NotImplementedError,
"bootstrap issue: python%i%i.zip contains non-ASCII "
"filenames without the unicode flag",
PY_MAJOR_VERSION, PY_MINOR_VERSION);
}
goto error;
}
if (PyUnicode_READY(nameobj) == -1) {
goto error;
}
path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj);
if (path == NULL) {
goto error;
}
t = Py_BuildValue("NHIIkHHI", path, compress, data_size,
file_size, file_offset, time, date, crc);
if (t == NULL) {
goto error;
}
err = PyDict_SetItem(files, nameobj, t);
Py_CLEAR(nameobj);
Py_DECREF(t);
if (err != 0) {
goto error;
}
count++;
}
fclose(fp);
if (Py_VerboseFlag) {
PySys_FormatStderr("# zipimport: found %u names in %R\n",
count, archive);
}
return files;
eof_error:
set_file_error(archive, !ferror(fp));
goto error;
file_error:
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive);
goto error;
invalid_header:
assert(errmsg != NULL);
PyErr_Format(ZipImportError, "%s: %R", errmsg, archive);
goto error;
error:
fclose(fp);
Py_XDECREF(files);
Py_XDECREF(nameobj);
return NULL;
}
/* Return the zlib.decompress function object, or NULL if zlib couldn't
be imported. The function is cached when found, so subsequent calls
don't import zlib again. */
static PyObject *
get_decompress_func(void)
{
static int importing_zlib = 0;
PyObject *zlib;
PyObject *decompress;
_Py_IDENTIFIER(decompress);
if (importing_zlib != 0)
/* Someone has a zlib.pyc in their Zip file;
let's avoid a stack overflow. */
return NULL;
importing_zlib = 1;
zlib = PyImport_ImportModuleNoBlock("zlib");
importing_zlib = 0;
if (zlib != NULL) {
decompress = _PyObject_GetAttrId(zlib,
&PyId_decompress);
Py_DECREF(zlib);
}
else {
PyErr_Clear();
decompress = NULL;
}
if (Py_VerboseFlag)
PySys_WriteStderr("# zipimport: zlib %s\n",
zlib != NULL ? "available": "UNAVAILABLE");
return decompress;
}
/* Given a path to a Zip file and a toc_entry, return the (uncompressed)
data as a new reference. */
static PyObject *
get_data(PyObject *archive, PyObject *toc_entry)
{
PyObject *raw_data = NULL, *data, *decompress;
char *buf;
FILE *fp;
PyObject *datapath;
unsigned short compress, time, date;
unsigned int crc;
Py_ssize_t data_size, file_size, bytes_size;
long file_offset, header_size;
unsigned char buffer[30];
const char *errmsg = NULL;
if (!PyArg_ParseTuple(toc_entry, "OHnnlHHI", &datapath, &compress,
&data_size, &file_size, &file_offset, &time,
&date, &crc)) {
return NULL;
}
if (data_size < 0) {
PyErr_Format(ZipImportError, "negative data size");
return NULL;
}
fp = _Py_fopen_obj(archive, "rb");
if (!fp) {
return NULL;
}
/* Check to make sure the local file header is correct */
if (fseek(fp, file_offset, 0) == -1) {
goto file_error;
}
if (fread(buffer, 1, 30, fp) != 30) {
goto eof_error;
}
if (get_uint32(buffer) != 0x04034B50u) {
/* Bad: Local File Header */
errmsg = "bad local file header";
goto invalid_header;
}
header_size = (unsigned int)30 +
get_uint16(buffer + 26) /* file name */ +
get_uint16(buffer + 28) /* extra field */;
if (file_offset > LONG_MAX - header_size) {
errmsg = "bad local file header size";
goto invalid_header;
}
file_offset += header_size; /* Start of file data */
if (data_size > LONG_MAX - 1) {
fclose(fp);
PyErr_NoMemory();
return NULL;
}
bytes_size = compress == 0 ? data_size : data_size + 1;
if (bytes_size == 0) {
bytes_size++;
}
raw_data = PyBytes_FromStringAndSize((char *)NULL, bytes_size);
if (raw_data == NULL) {
goto error;
}
buf = PyBytes_AsString(raw_data);
if (fseek(fp, file_offset, 0) == -1) {
goto file_error;
}
if (fread(buf, 1, data_size, fp) != (size_t)data_size) {
PyErr_SetString(PyExc_OSError,
"zipimport: can't read data");
goto error;
}
fclose(fp);
fp = NULL;
if (compress != 0) {
buf[data_size] = 'Z'; /* saw this in zipfile.py */
data_size++;
}
buf[data_size] = '\0';
if (compress == 0) { /* data is not compressed */
data = PyBytes_FromStringAndSize(buf, data_size);
Py_DECREF(raw_data);
return data;
}
/* Decompress with zlib */
decompress = get_decompress_func();
if (decompress == NULL) {
PyErr_SetString(ZipImportError,
"can't decompress data; "
"zlib not available");
goto error;
}
data = PyObject_CallFunction(decompress, "Oi", raw_data, -15);
Py_DECREF(decompress);
Py_DECREF(raw_data);
if (data != NULL && !PyBytes_Check(data)) {
PyErr_Format(PyExc_TypeError,
"zlib.decompress() must return a bytes object, not "
"%.200s",
Py_TYPE(data)->tp_name);
Py_DECREF(data);
return NULL;
}
return data;
eof_error:
set_file_error(archive, !ferror(fp));
goto error;
file_error:
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive);
goto error;
invalid_header:
assert(errmsg != NULL);
PyErr_Format(ZipImportError, "%s: %R", errmsg, archive);
goto error;
error:
if (fp != NULL) {
fclose(fp);
}
Py_XDECREF(raw_data);
return NULL;
}
/* Lenient date/time comparison function. The precision of the mtime
in the archive is lower than the mtime stored in a .pyc: we
must allow a difference of at most one second. */
static int
eq_mtime(time_t t1, time_t t2)
{
time_t d = t1 - t2;
if (d < 0)
d = -d;
/* dostime only stores even seconds, so be lenient */
return d <= 1;
}
/* Given the contents of a .pyc file in a buffer, unmarshal the data
and return the code object. Return None if it the magic word doesn't
match (we do this instead of raising an exception as we fall back
to .py if available and we don't want to mask other errors).
Returns a new reference. */
static PyObject *
unmarshal_code(PyObject *pathname, PyObject *data, time_t mtime)
{
PyObject *code;
unsigned char *buf = (unsigned char *)PyBytes_AsString(data);
Py_ssize_t size = PyBytes_Size(data);
if (size < 16) {
PyErr_SetString(ZipImportError,
"bad pyc data");
return NULL;
}
if (get_uint32(buf) != (unsigned int)PyImport_GetMagicNumber()) {
if (Py_VerboseFlag) {
PySys_FormatStderr("# %R has bad magic\n",
pathname);
}
Py_RETURN_NONE; /* signal caller to try alternative */
}
uint32_t flags = get_uint32(buf + 4);
if (flags != 0) {
_PyCoreConfig *config = &_PyInterpreterState_Get()->core_config;
// Hash-based pyc. We currently refuse to handle checked hash-based
// pycs. We could validate hash-based pycs against the source, but it
// seems likely that most people putting hash-based pycs in a zipfile
// will use unchecked ones.
if (strcmp(config->_check_hash_pycs_mode, "never") &&
(flags != 0x1 || !strcmp(config->_check_hash_pycs_mode, "always")))
Py_RETURN_NONE;
} else if ((mtime != 0 && !eq_mtime(get_uint32(buf + 8), mtime))) {
if (Py_VerboseFlag) {
PySys_FormatStderr("# %R has bad mtime\n",
pathname);
}
Py_RETURN_NONE; /* signal caller to try alternative */
}
/* XXX the pyc's size field is ignored; timestamp collisions are probably
unimportant with zip files. */
code = PyMarshal_ReadObjectFromString((char *)buf + 16, size - 16);
if (code == NULL) {
return NULL;
}
if (!PyCode_Check(code)) {
Py_DECREF(code);
PyErr_Format(PyExc_TypeError,
"compiled module %R is not a code object",
pathname);
return NULL;
}
return code;
}
/* Replace any occurrences of "\r\n?" in the input string with "\n".
This converts DOS and Mac line endings to Unix line endings.
Also append a trailing "\n" to be compatible with
PyParser_SimpleParseFile(). Returns a new reference. */
static PyObject *
normalize_line_endings(PyObject *source)
{
char *buf, *q, *p;
PyObject *fixed_source;
int len = 0;
p = PyBytes_AsString(source);
if (p == NULL) {
return PyBytes_FromStringAndSize("\n\0", 2);
}
/* one char extra for trailing \n and one for terminating \0 */
buf = (char *)PyMem_Malloc(PyBytes_Size(source) + 2);
if (buf == NULL) {
PyErr_SetString(PyExc_MemoryError,
"zipimport: no memory to allocate "
"source buffer");
return NULL;
}
/* replace "\r\n?" by "\n" */
for (q = buf; *p != '\0'; p++) {
if (*p == '\r') {
*q++ = '\n';
if (*(p + 1) == '\n')
p++;
}
else
*q++ = *p;
len++;
}
*q++ = '\n'; /* add trailing \n */
*q = '\0';
fixed_source = PyBytes_FromStringAndSize(buf, len + 2);
PyMem_Free(buf);
return fixed_source;
}
/* Given a string buffer containing Python source code, compile it
and return a code object as a new reference. */
static PyObject *
compile_source(PyObject *pathname, PyObject *source)
{
PyObject *code, *fixed_source;
fixed_source = normalize_line_endings(source);
if (fixed_source == NULL) {
return NULL;
}
code = Py_CompileStringObject(PyBytes_AsString(fixed_source),
pathname, Py_file_input, NULL, -1);
Py_DECREF(fixed_source);
return code;
}
/* Convert the date/time values found in the Zip archive to a value
that's compatible with the time stamp stored in .pyc files. */
static time_t
parse_dostime(int dostime, int dosdate)
{
struct tm stm;
memset((void *) &stm, '\0', sizeof(stm));
stm.tm_sec = (dostime & 0x1f) * 2;
stm.tm_min = (dostime >> 5) & 0x3f;
stm.tm_hour = (dostime >> 11) & 0x1f;
stm.tm_mday = dosdate & 0x1f;
stm.tm_mon = ((dosdate >> 5) & 0x0f) - 1;
stm.tm_year = ((dosdate >> 9) & 0x7f) + 80;
stm.tm_isdst = -1; /* wday/yday is ignored */
return mktime(&stm);
}
/* Given a path to a .pyc file in the archive, return the
modification time of the matching .py file, or 0 if no source
is available. */
static time_t
get_mtime_of_source(ZipImporter *self, PyObject *path)
{
PyObject *toc_entry, *stripped;
time_t mtime;
/* strip 'c' from *.pyc */
if (PyUnicode_READY(path) == -1)
return (time_t)-1;
stripped = PyUnicode_FromKindAndData(PyUnicode_KIND(path),
PyUnicode_DATA(path),
PyUnicode_GET_LENGTH(path) - 1);
if (stripped == NULL)
return (time_t)-1;
toc_entry = PyDict_GetItem(self->files, stripped);
Py_DECREF(stripped);
if (toc_entry != NULL && PyTuple_Check(toc_entry) &&
PyTuple_Size(toc_entry) == 8) {
/* fetch the time stamp of the .py file for comparison
with an embedded pyc time stamp */
int time, date;
time = PyLong_AsLong(PyTuple_GetItem(toc_entry, 5));
date = PyLong_AsLong(PyTuple_GetItem(toc_entry, 6));
mtime = parse_dostime(time, date);
} else
mtime = 0;
return mtime;
}
/* Return the code object for the module named by 'fullname' from the
Zip archive as a new reference. */
static PyObject *
get_code_from_data(ZipImporter *self, int ispackage, int isbytecode,
time_t mtime, PyObject *toc_entry)
{
PyObject *data, *modpath, *code;
data = get_data(self->archive, toc_entry);
if (data == NULL)
return NULL;
modpath = PyTuple_GetItem(toc_entry, 0);
if (isbytecode)
code = unmarshal_code(modpath, data, mtime);
else
code = compile_source(modpath, data);
Py_DECREF(data);
return code;
}
/* Get the code object associated with the module specified by
'fullname'. */
static PyObject *
get_module_code(ZipImporter *self, PyObject *fullname,
int *p_ispackage, PyObject **p_modpath)
{
PyObject *code = NULL, *toc_entry, *subname;
PyObject *path, *fullpath = NULL;
struct st_zip_searchorder *zso;
if (self->prefix == NULL) {
PyErr_SetString(PyExc_ValueError,
"zipimporter.__init__() wasn't called");
return NULL;
}
subname = get_subname(fullname);
if (subname == NULL)
return NULL;
path = make_filename(self->prefix, subname);
Py_DECREF(subname);
if (path == NULL)
return NULL;
for (zso = zip_searchorder; *zso->suffix; zso++) {
code = NULL;
fullpath = PyUnicode_FromFormat("%U%s", path, zso->suffix);
if (fullpath == NULL)
goto exit;
if (Py_VerboseFlag > 1)
PySys_FormatStderr("# trying %U%c%U\n",
self->archive, (int)SEP, fullpath);
toc_entry = PyDict_GetItem(self->files, fullpath);
if (toc_entry != NULL) {
time_t mtime = 0;
int ispackage = zso->type & IS_PACKAGE;
int isbytecode = zso->type & IS_BYTECODE;
if (isbytecode) {
mtime = get_mtime_of_source(self, fullpath);
if (mtime == (time_t)-1 && PyErr_Occurred()) {
goto exit;
}
}
Py_CLEAR(fullpath);
if (p_ispackage != NULL)
*p_ispackage = ispackage;
code = get_code_from_data(self, ispackage,
isbytecode, mtime,
toc_entry);
if (code == Py_None) {
/* bad magic number or non-matching mtime
in byte code, try next */
Py_DECREF(code);
continue;
}
if (code != NULL && p_modpath != NULL) {
*p_modpath = PyTuple_GetItem(toc_entry, 0);
Py_INCREF(*p_modpath);
}
goto exit;
}
else
Py_CLEAR(fullpath);
}
PyErr_Format(ZipImportError, "can't find module %R", fullname);
exit:
Py_DECREF(path);
Py_XDECREF(fullpath);
return code;
}
/* Module init */
PyDoc_STRVAR(zipimport_doc,
"zipimport provides support for importing Python modules from Zip archives.\n\
\n\
This module exports three objects:\n\
- zipimporter: a class; its constructor takes a path to a Zip archive.\n\
- ZipImportError: exception raised by zipimporter objects. It's a\n\
subclass of ImportError, so it can be caught as ImportError, too.\n\
- _zip_directory_cache: a dict, mapping archive paths to zip directory\n\
info dicts, as used in zipimporter._files.\n\
\n\
It is usually not needed to use the zipimport module explicitly; it is\n\
used by the builtin import mechanism for sys.path items that are paths\n\
to Zip archives.");
static struct PyModuleDef zipimportmodule = {
PyModuleDef_HEAD_INIT,
"zipimport",
zipimport_doc,
-1,
NULL,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC
PyInit_zipimport(void)
{
PyObject *mod;
if (PyType_Ready(&ZipImporter_Type) < 0)
return NULL;
/* Correct directory separator */
zip_searchorder[0].suffix[0] = SEP;
zip_searchorder[1].suffix[0] = SEP;
mod = PyModule_Create(&zipimportmodule);
if (mod == NULL)
return NULL;
ZipImportError = PyErr_NewException("zipimport.ZipImportError",
PyExc_ImportError, NULL);
if (ZipImportError == NULL)
return NULL;
Py_INCREF(ZipImportError);
if (PyModule_AddObject(mod, "ZipImportError",
ZipImportError) < 0)
return NULL;
Py_INCREF(&ZipImporter_Type);
if (PyModule_AddObject(mod, "zipimporter",
(PyObject *)&ZipImporter_Type) < 0)
return NULL;
zip_directory_cache = PyDict_New();
if (zip_directory_cache == NULL)
return NULL;
Py_INCREF(zip_directory_cache);
if (PyModule_AddObject(mod, "_zip_directory_cache",
zip_directory_cache) < 0)
return NULL;
return mod;
}
......@@ -35,7 +35,6 @@ extern PyObject* PyInit__weakref(void);
/* XXX: These two should really be extracted to standalone extensions. */
extern PyObject* PyInit_xxsubtype(void);
extern PyObject* PyInit__xxsubinterpreters(void);
extern PyObject* PyInit_zipimport(void);
extern PyObject* PyInit__random(void);
extern PyObject* PyInit_itertools(void);
extern PyObject* PyInit__collections(void);
......@@ -131,7 +130,6 @@ struct _inittab _PyImport_Inittab[] = {
{"xxsubtype", PyInit_xxsubtype},
{"_xxsubinterpreters", PyInit__xxsubinterpreters},
{"zipimport", PyInit_zipimport},
#ifdef _Py_HAVE_ZLIB
{"zlib", PyInit_zlib},
#endif
......
......@@ -77,19 +77,26 @@
</ItemGroup>
<ItemGroup>
<None Include="..\Lib\importlib\_bootstrap.py">
<ModName>importlib._bootstrap</ModName>
<IntFile>$(IntDir)importlib.g.h</IntFile>
<OutFile>$(PySourcePath)Python\importlib.h</OutFile>
</None>
<None Include="..\Lib\importlib\_bootstrap_external.py">
<ModName>importlib._bootstrap_external</ModName>
<IntFile>$(IntDir)importlib_external.g.h</IntFile>
<OutFile>$(PySourcePath)Python\importlib_external.h</OutFile>
</None>
<None Include="..\Lib\zipimport.py">
<ModName>zipimport</ModName>
<IntFile>$(IntDir)importlib_zipimport.g.h</IntFile>
<OutFile>$(PySourcePath)Python\importlib_zipimport.h</OutFile>
</None>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="_RebuildImportLib">
<Exec Command='"$(TargetPath)" "%(None.FullPath)" "%(None.IntFile)"' />
<Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
<PropertyGroup>
<_OldContent Condition="Exists($(OutTargetPath))"></_OldContent>
......@@ -114,6 +121,7 @@
<ItemGroup>
<Clean Include="$(IntDir)importlib.g.h" />
<Clean Include="$(IntDir)importlib_external.g.h" />
<Clean Include="$(IntDir)importlib_zipimport.g.h" />
</ItemGroup>
</Target>
</Project>
......@@ -282,7 +282,6 @@
<ClCompile Include="..\Modules\timemodule.c" />
<ClCompile Include="..\Modules\xxsubtype.c" />
<ClCompile Include="..\Modules\_xxsubinterpretersmodule.c" />
<ClCompile Include="..\Modules\zipimport.c" />
<ClCompile Include="..\Modules\_io\fileio.c" />
<ClCompile Include="..\Modules\_io\bytesio.c" />
<ClCompile Include="..\Modules\_io\stringio.c" />
......
......@@ -617,9 +617,6 @@
<ClCompile Include="..\Modules\xxsubtype.c">
<Filter>Modules</Filter>
</ClCompile>
<ClCompile Include="..\Modules\zipimport.c">
<Filter>Modules</Filter>
</ClCompile>
<ClCompile Include="..\Modules\zlibmodule.c">
<Filter>Modules</Filter>
</ClCompile>
......
......@@ -27,28 +27,30 @@ static const struct _frozen _PyImport_FrozenModules[] = {
const struct _frozen *PyImport_FrozenModules;
#endif
const char header[] = "/* Auto-generated by Programs/_freeze_importlib.c */";
static const char header[] =
"/* Auto-generated by Programs/_freeze_importlib.c */";
int
main(int argc, char *argv[])
{
char *inpath, *outpath, *code_name;
const char *name, *inpath, *outpath;
char buf[100];
FILE *infile = NULL, *outfile = NULL;
struct _Py_stat_struct status;
size_t text_size, data_size, n;
size_t text_size, data_size, i, n;
char *text = NULL;
unsigned char *data;
PyObject *code = NULL, *marshalled = NULL;
int is_bootstrap = 1;
PyImport_FrozenModules = _PyImport_FrozenModules;
if (argc != 3) {
fprintf(stderr, "need to specify input and output paths\n");
if (argc != 4) {
fprintf(stderr, "need to specify the name, input and output paths\n");
return 2;
}
inpath = argv[1];
outpath = argv[2];
name = argv[1];
inpath = argv[2];
outpath = argv[3];
infile = fopen(inpath, "rb");
if (infile == NULL) {
fprintf(stderr, "cannot open '%s' for reading\n", inpath);
......@@ -90,14 +92,8 @@ main(int argc, char *argv[])
_Py_FatalInitError(err);
}
if (strstr(inpath, "_external") != NULL) {
is_bootstrap = 0;
}
code_name = is_bootstrap ?
"<frozen importlib._bootstrap>" :
"<frozen importlib._bootstrap_external>";
code = Py_CompileStringExFlags(text, code_name, Py_file_input, NULL, 0);
sprintf(buf, "<frozen %s>", name);
code = Py_CompileStringExFlags(text, buf, Py_file_input, NULL, 0);
if (code == NULL)
goto error;
free(text);
......@@ -120,11 +116,13 @@ main(int argc, char *argv[])
goto error;
}
fprintf(outfile, "%s\n", header);
if (is_bootstrap)
fprintf(outfile, "const unsigned char _Py_M__importlib[] = {\n");
else
fprintf(outfile,
"const unsigned char _Py_M__importlib_external[] = {\n");
for (i = n = 0; name[i] != '\0'; i++) {
if (name[i] != '.') {
buf[n++] = name[i];
}
}
buf[n] = '\0';
fprintf(outfile, "const unsigned char _Py_M__%s[] = {\n", buf);
for (n = 0; n < data_size; n += 16) {
size_t i, end = Py_MIN(n + 16, data_size);
fprintf(outfile, " ");
......
......@@ -4,6 +4,7 @@
#include "Python.h"
#include "importlib.h"
#include "importlib_external.h"
#include "importlib_zipimport.h"
/* In order to test the support for frozen modules, by default we
define a single frozen module, __hello__. Loading it will print
......@@ -29,9 +30,12 @@ static unsigned char M___hello__[] = {
static const struct _frozen _PyImport_FrozenModules[] = {
/* importlib */
{"_frozen_importlib", _Py_M__importlib, (int)sizeof(_Py_M__importlib)},
{"_frozen_importlib_external", _Py_M__importlib_external,
(int)sizeof(_Py_M__importlib_external)},
{"_frozen_importlib", _Py_M__importlib_bootstrap,
(int)sizeof(_Py_M__importlib_bootstrap)},
{"_frozen_importlib_external", _Py_M__importlib_bootstrap_external,
(int)sizeof(_Py_M__importlib_bootstrap_external)},
{"zipimport", _Py_M__zipimport,
(int)sizeof(_Py_M__zipimport)},
/* Test module */
{"__hello__", M___hello__, SIZE},
/* Test package (negative size indicates package-ness) */
......
/* Auto-generated by Programs/_freeze_importlib.c */
const unsigned char _Py_M__importlib[] = {
const unsigned char _Py_M__importlib_bootstrap[] = {
99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
0,64,0,0,0,115,208,1,0,0,100,0,90,0,100,1,
97,1,100,2,100,3,132,0,90,2,100,4,100,5,132,0,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Auto-generated by Programs/_freeze_importlib.c */
const unsigned char _Py_M__zipimport[] = {
99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
0,64,0,0,0,115,48,1,0,0,100,0,90,0,100,1,
100,2,108,1,90,2,100,1,100,3,108,1,109,3,90,3,
109,4,90,4,1,0,100,1,100,2,108,5,90,6,100,1,
100,2,108,7,90,7,100,1,100,2,108,8,90,8,100,1,
100,2,108,9,90,9,100,1,100,2,108,10,90,10,100,1,
100,2,108,11,90,11,100,4,100,5,103,2,90,12,101,2,
106,13,90,13,101,2,106,14,100,6,100,2,133,2,25,0,
90,15,71,0,100,7,100,4,132,0,100,4,101,16,131,3,
90,17,105,0,90,18,101,19,101,10,131,1,90,20,71,0,
100,8,100,5,132,0,100,5,131,2,90,21,101,13,100,9,
23,0,100,10,100,10,102,3,101,13,100,11,23,0,100,12,
100,10,102,3,100,13,100,14,102,4,90,22,100,15,100,16,
132,0,90,23,100,17,100,18,132,0,90,24,100,19,100,20,
132,0,90,25,100,21,100,22,132,0,90,26,100,23,90,27,
100,12,97,28,100,24,100,25,132,0,90,29,100,26,100,27,
132,0,90,30,100,28,100,29,132,0,90,31,100,30,100,31,
132,0,90,32,101,19,101,32,106,33,131,1,90,34,100,32,
100,33,132,0,90,35,100,34,100,35,132,0,90,36,100,36,
100,37,132,0,90,37,100,38,100,39,132,0,90,38,100,40,
100,41,132,0,90,39,100,2,83,0,41,42,97,80,2,0,
0,122,105,112,105,109,112,111,114,116,32,112,114,111,118,105,
100,101,115,32,115,117,112,112,111,114,116,32,102,111,114,32,
105,109,112,111,114,116,105,110,103,32,80,121,116,104,111,110,
32,109,111,100,117,108,101,115,32,102,114,111,109,32,90,105,
112,32,97,114,99,104,105,118,101,115,46,10,10,84,104,105,
115,32,109,111,100,117,108,101,32,101,120,112,111,114,116,115,
32,116,104,114,101,101,32,111,98,106,101,99,116,115,58,10,
45,32,122,105,112,105,109,112,111,114,116,101,114,58,32,97,
32,99,108,97,115,115,59,32,105,116,115,32,99,111,110,115,
116,114,117,99,116,111,114,32,116,97,107,101,115,32,97,32,
112,97,116,104,32,116,111,32,97,32,90,105,112,32,97,114,
99,104,105,118,101,46,10,45,32,90,105,112,73,109,112,111,
114,116,69,114,114,111,114,58,32,101,120,99,101,112,116,105,
111,110,32,114,97,105,115,101,100,32,98,121,32,122,105,112,
105,109,112,111,114,116,101,114,32,111,98,106,101,99,116,115,
46,32,73,116,39,115,32,97,10,32,32,115,117,98,99,108,
97,115,115,32,111,102,32,73,109,112,111,114,116,69,114,114,
111,114,44,32,115,111,32,105,116,32,99,97,110,32,98,101,
32,99,97,117,103,104,116,32,97,115,32,73,109,112,111,114,
116,69,114,114,111,114,44,32,116,111,111,46,10,45,32,95,
122,105,112,95,100,105,114,101,99,116,111,114,121,95,99,97,
99,104,101,58,32,97,32,100,105,99,116,44,32,109,97,112,
112,105,110,103,32,97,114,99,104,105,118,101,32,112,97,116,
104,115,32,116,111,32,122,105,112,32,100,105,114,101,99,116,
111,114,121,10,32,32,105,110,102,111,32,100,105,99,116,115,
44,32,97,115,32,117,115,101,100,32,105,110,32,122,105,112,
105,109,112,111,114,116,101,114,46,95,102,105,108,101,115,46,
10,10,73,116,32,105,115,32,117,115,117,97,108,108,121,32,
110,111,116,32,110,101,101,100,101,100,32,116,111,32,117,115,
101,32,116,104,101,32,122,105,112,105,109,112,111,114,116,32,
109,111,100,117,108,101,32,101,120,112,108,105,99,105,116,108,
121,59,32,105,116,32,105,115,10,117,115,101,100,32,98,121,
32,116,104,101,32,98,117,105,108,116,105,110,32,105,109,112,
111,114,116,32,109,101,99,104,97,110,105,115,109,32,102,111,
114,32,115,121,115,46,112,97,116,104,32,105,116,101,109,115,
32,116,104,97,116,32,97,114,101,32,112,97,116,104,115,10,
116,111,32,90,105,112,32,97,114,99,104,105,118,101,115,46,
10,233,0,0,0,0,78,41,2,218,14,95,117,110,112,97,
99,107,95,117,105,110,116,49,54,218,14,95,117,110,112,97,
99,107,95,117,105,110,116,51,50,218,14,90,105,112,73,109,
112,111,114,116,69,114,114,111,114,218,11,122,105,112,105,109,
112,111,114,116,101,114,233,1,0,0,0,99,0,0,0,0,
0,0,0,0,0,0,0,0,1,0,0,0,64,0,0,0,
115,12,0,0,0,101,0,90,1,100,0,90,2,100,1,83,
0,41,2,114,3,0,0,0,78,41,3,218,8,95,95,110,
97,109,101,95,95,218,10,95,95,109,111,100,117,108,101,95,
95,218,12,95,95,113,117,97,108,110,97,109,101,95,95,169,
0,114,9,0,0,0,114,9,0,0,0,250,18,60,102,114,
111,122,101,110,32,122,105,112,105,109,112,111,114,116,62,114,
3,0,0,0,33,0,0,0,115,2,0,0,0,8,1,99,
0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,
64,0,0,0,115,108,0,0,0,101,0,90,1,100,0,90,
2,100,1,90,3,100,2,100,3,132,0,90,4,100,25,100,
5,100,6,132,1,90,5,100,26,100,7,100,8,132,1,90,
6,100,9,100,10,132,0,90,7,100,11,100,12,132,0,90,
8,100,13,100,14,132,0,90,9,100,15,100,16,132,0,90,
10,100,17,100,18,132,0,90,11,100,19,100,20,132,0,90,
12,100,21,100,22,132,0,90,13,100,23,100,24,132,0,90,
14,100,4,83,0,41,27,114,4,0,0,0,97,255,1,0,
0,122,105,112,105,109,112,111,114,116,101,114,40,97,114,99,
104,105,118,101,112,97,116,104,41,32,45,62,32,122,105,112,
105,109,112,111,114,116,101,114,32,111,98,106,101,99,116,10,
10,32,32,32,32,67,114,101,97,116,101,32,97,32,110,101,
119,32,122,105,112,105,109,112,111,114,116,101,114,32,105,110,
115,116,97,110,99,101,46,32,39,97,114,99,104,105,118,101,
112,97,116,104,39,32,109,117,115,116,32,98,101,32,97,32,
112,97,116,104,32,116,111,10,32,32,32,32,97,32,122,105,
112,102,105,108,101,44,32,111,114,32,116,111,32,97,32,115,
112,101,99,105,102,105,99,32,112,97,116,104,32,105,110,115,
105,100,101,32,97,32,122,105,112,102,105,108,101,46,32,70,
111,114,32,101,120,97,109,112,108,101,44,32,105,116,32,99,
97,110,32,98,101,10,32,32,32,32,39,47,116,109,112,47,
109,121,105,109,112,111,114,116,46,122,105,112,39,44,32,111,
114,32,39,47,116,109,112,47,109,121,105,109,112,111,114,116,
46,122,105,112,47,109,121,100,105,114,101,99,116,111,114,121,
39,44,32,105,102,32,109,121,100,105,114,101,99,116,111,114,
121,32,105,115,32,97,10,32,32,32,32,118,97,108,105,100,
32,100,105,114,101,99,116,111,114,121,32,105,110,115,105,100,
101,32,116,104,101,32,97,114,99,104,105,118,101,46,10,10,
32,32,32,32,39,90,105,112,73,109,112,111,114,116,69,114,
114,111,114,32,105,115,32,114,97,105,115,101,100,32,105,102,
32,39,97,114,99,104,105,118,101,112,97,116,104,39,32,100,
111,101,115,110,39,116,32,112,111,105,110,116,32,116,111,32,
97,32,118,97,108,105,100,32,90,105,112,10,32,32,32,32,
97,114,99,104,105,118,101,46,10,10,32,32,32,32,84,104,
101,32,39,97,114,99,104,105,118,101,39,32,97,116,116,114,
105,98,117,116,101,32,111,102,32,122,105,112,105,109,112,111,
114,116,101,114,32,111,98,106,101,99,116,115,32,99,111,110,
116,97,105,110,115,32,116,104,101,32,110,97,109,101,32,111,
102,32,116,104,101,10,32,32,32,32,122,105,112,102,105,108,
101,32,116,97,114,103,101,116,101,100,46,10,32,32,32,32,
99,2,0,0,0,0,0,0,0,8,0,0,0,9,0,0,
0,67,0,0,0,115,36,1,0,0,116,0,124,1,116,1,
131,2,115,28,100,1,100,0,108,2,125,2,124,2,160,3,
124,1,161,1,125,1,124,1,115,44,116,4,100,2,124,1,
100,3,141,2,130,1,116,5,114,60,124,1,160,6,116,5,
116,7,161,2,125,1,103,0,125,3,122,14,116,8,160,9,
124,1,161,1,125,4,87,0,110,72,4,0,116,10,116,11,
102,2,107,10,114,150,1,0,1,0,1,0,116,8,160,12,
124,1,161,1,92,2,125,5,125,6,124,5,124,1,107,2,
114,132,116,4,100,4,124,1,100,3,141,2,130,1,124,5,
125,1,124,3,160,13,124,6,161,1,1,0,89,0,113,64,
88,0,124,4,106,14,100,5,64,0,100,6,107,3,114,182,
116,4,100,4,124,1,100,3,141,2,130,1,113,182,113,64,
122,12,116,15,124,1,25,0,125,7,87,0,110,36,4,0,
116,16,107,10,114,230,1,0,1,0,1,0,116,17,124,1,
131,1,125,7,124,7,116,15,124,1,60,0,89,0,110,2,
88,0,124,7,124,0,95,18,124,1,124,0,95,19,116,8,
106,20,124,3,100,0,100,0,100,7,133,3,25,0,142,0,
124,0,95,21,124,0,106,21,144,1,114,32,124,0,4,0,
106,21,116,7,55,0,2,0,95,21,100,0,83,0,41,8,
78,114,0,0,0,0,122,21,97,114,99,104,105,118,101,32,
112,97,116,104,32,105,115,32,101,109,112,116,121,41,1,218,
4,112,97,116,104,122,14,110,111,116,32,97,32,90,105,112,
32,102,105,108,101,105,0,240,0,0,105,0,128,0,0,233,
255,255,255,255,41,22,218,10,105,115,105,110,115,116,97,110,
99,101,218,3,115,116,114,218,2,111,115,90,8,102,115,100,
101,99,111,100,101,114,3,0,0,0,218,12,97,108,116,95,
112,97,116,104,95,115,101,112,218,7,114,101,112,108,97,99,
101,218,8,112,97,116,104,95,115,101,112,218,19,95,98,111,
111,116,115,116,114,97,112,95,101,120,116,101,114,110,97,108,
90,10,95,112,97,116,104,95,115,116,97,116,218,7,79,83,
69,114,114,111,114,218,10,86,97,108,117,101,69,114,114,111,
114,90,11,95,112,97,116,104,95,115,112,108,105,116,218,6,
97,112,112,101,110,100,90,7,115,116,95,109,111,100,101,218,
20,95,122,105,112,95,100,105,114,101,99,116,111,114,121,95,
99,97,99,104,101,218,8,75,101,121,69,114,114,111,114,218,
15,95,114,101,97,100,95,100,105,114,101,99,116,111,114,121,
218,6,95,102,105,108,101,115,218,7,97,114,99,104,105,118,
101,218,10,95,112,97,116,104,95,106,111,105,110,218,6,112,
114,101,102,105,120,41,8,218,4,115,101,108,102,114,11,0,
0,0,114,15,0,0,0,114,29,0,0,0,90,2,115,116,
90,7,100,105,114,110,97,109,101,90,8,98,97,115,101,110,
97,109,101,218,5,102,105,108,101,115,114,9,0,0,0,114,
9,0,0,0,114,10,0,0,0,218,8,95,95,105,110,105,
116,95,95,60,0,0,0,115,58,0,0,0,0,1,10,1,
8,1,10,1,4,1,12,1,4,1,12,2,4,2,2,1,
14,1,18,3,14,1,8,1,12,1,4,1,16,3,14,2,
12,1,4,2,2,1,12,1,14,1,8,1,14,1,6,1,
6,2,22,1,8,1,122,20,122,105,112,105,109,112,111,114,
116,101,114,46,95,95,105,110,105,116,95,95,78,99,3,0,
0,0,0,0,0,0,5,0,0,0,4,0,0,0,67,0,
0,0,115,78,0,0,0,116,0,124,0,124,1,131,2,125,
3,124,3,100,1,107,9,114,26,124,0,103,0,102,2,83,
0,116,1,124,0,124,1,131,2,125,4,116,2,124,0,124,
4,131,2,114,70,100,1,124,0,106,3,155,0,116,4,155,
0,124,4,155,0,157,3,103,1,102,2,83,0,100,1,103,
0,102,2,83,0,41,2,97,239,1,0,0,102,105,110,100,
95,108,111,97,100,101,114,40,102,117,108,108,110,97,109,101,
44,32,112,97,116,104,61,78,111,110,101,41,32,45,62,32,
115,101,108,102,44,32,115,116,114,32,111,114,32,78,111,110,
101,46,10,10,32,32,32,32,32,32,32,32,83,101,97,114,
99,104,32,102,111,114,32,97,32,109,111,100,117,108,101,32,
115,112,101,99,105,102,105,101,100,32,98,121,32,39,102,117,
108,108,110,97,109,101,39,46,32,39,102,117,108,108,110,97,
109,101,39,32,109,117,115,116,32,98,101,32,116,104,101,10,
32,32,32,32,32,32,32,32,102,117,108,108,121,32,113,117,
97,108,105,102,105,101,100,32,40,100,111,116,116,101,100,41,
32,109,111,100,117,108,101,32,110,97,109,101,46,32,73,116,
32,114,101,116,117,114,110,115,32,116,104,101,32,122,105,112,
105,109,112,111,114,116,101,114,10,32,32,32,32,32,32,32,
32,105,110,115,116,97,110,99,101,32,105,116,115,101,108,102,
32,105,102,32,116,104,101,32,109,111,100,117,108,101,32,119,
97,115,32,102,111,117,110,100,44,32,97,32,115,116,114,105,
110,103,32,99,111,110,116,97,105,110,105,110,103,32,116,104,
101,10,32,32,32,32,32,32,32,32,102,117,108,108,32,112,
97,116,104,32,110,97,109,101,32,105,102,32,105,116,39,115,
32,112,111,115,115,105,98,108,121,32,97,32,112,111,114,116,
105,111,110,32,111,102,32,97,32,110,97,109,101,115,112,97,
99,101,32,112,97,99,107,97,103,101,44,10,32,32,32,32,
32,32,32,32,111,114,32,78,111,110,101,32,111,116,104,101,
114,119,105,115,101,46,32,84,104,101,32,111,112,116,105,111,
110,97,108,32,39,112,97,116,104,39,32,97,114,103,117,109,
101,110,116,32,105,115,32,105,103,110,111,114,101,100,32,45,
45,32,105,116,39,115,10,32,32,32,32,32,32,32,32,116,
104,101,114,101,32,102,111,114,32,99,111,109,112,97,116,105,
98,105,108,105,116,121,32,119,105,116,104,32,116,104,101,32,
105,109,112,111,114,116,101,114,32,112,114,111,116,111,99,111,
108,46,10,32,32,32,32,32,32,32,32,78,41,5,218,16,
95,103,101,116,95,109,111,100,117,108,101,95,105,110,102,111,
218,16,95,103,101,116,95,109,111,100,117,108,101,95,112,97,
116,104,218,7,95,105,115,95,100,105,114,114,27,0,0,0,
114,18,0,0,0,41,5,114,30,0,0,0,218,8,102,117,
108,108,110,97,109,101,114,11,0,0,0,218,2,109,105,218,
7,109,111,100,112,97,116,104,114,9,0,0,0,114,9,0,
0,0,114,10,0,0,0,218,11,102,105,110,100,95,108,111,
97,100,101,114,106,0,0,0,115,14,0,0,0,0,10,10,
1,8,2,8,7,10,1,10,4,24,2,122,23,122,105,112,
105,109,112,111,114,116,101,114,46,102,105,110,100,95,108,111,
97,100,101,114,99,3,0,0,0,0,0,0,0,3,0,0,
0,4,0,0,0,67,0,0,0,115,16,0,0,0,124,0,
160,0,124,1,124,2,161,2,100,1,25,0,83,0,41,2,
97,139,1,0,0,102,105,110,100,95,109,111,100,117,108,101,
40,102,117,108,108,110,97,109,101,44,32,112,97,116,104,61,
78,111,110,101,41,32,45,62,32,115,101,108,102,32,111,114,
32,78,111,110,101,46,10,10,32,32,32,32,32,32,32,32,
83,101,97,114,99,104,32,102,111,114,32,97,32,109,111,100,
117,108,101,32,115,112,101,99,105,102,105,101,100,32,98,121,
32,39,102,117,108,108,110,97,109,101,39,46,32,39,102,117,
108,108,110,97,109,101,39,32,109,117,115,116,32,98,101,32,
116,104,101,10,32,32,32,32,32,32,32,32,102,117,108,108,
121,32,113,117,97,108,105,102,105,101,100,32,40,100,111,116,
116,101,100,41,32,109,111,100,117,108,101,32,110,97,109,101,
46,32,73,116,32,114,101,116,117,114,110,115,32,116,104,101,
32,122,105,112,105,109,112,111,114,116,101,114,10,32,32,32,
32,32,32,32,32,105,110,115,116,97,110,99,101,32,105,116,
115,101,108,102,32,105,102,32,116,104,101,32,109,111,100,117,
108,101,32,119,97,115,32,102,111,117,110,100,44,32,111,114,
32,78,111,110,101,32,105,102,32,105,116,32,119,97,115,110,
39,116,46,10,32,32,32,32,32,32,32,32,84,104,101,32,
111,112,116,105,111,110,97,108,32,39,112,97,116,104,39,32,
97,114,103,117,109,101,110,116,32,105,115,32,105,103,110,111,
114,101,100,32,45,45,32,105,116,39,115,32,116,104,101,114,
101,32,102,111,114,32,99,111,109,112,97,116,105,98,105,108,
105,116,121,10,32,32,32,32,32,32,32,32,119,105,116,104,
32,116,104,101,32,105,109,112,111,114,116,101,114,32,112,114,
111,116,111,99,111,108,46,10,32,32,32,32,32,32,32,32,
114,0,0,0,0,41,1,114,39,0,0,0,41,3,114,30,
0,0,0,114,36,0,0,0,114,11,0,0,0,114,9,0,
0,0,114,9,0,0,0,114,10,0,0,0,218,11,102,105,
110,100,95,109,111,100,117,108,101,138,0,0,0,115,2,0,
0,0,0,9,122,23,122,105,112,105,109,112,111,114,116,101,
114,46,102,105,110,100,95,109,111,100,117,108,101,99,2,0,
0,0,0,0,0,0,5,0,0,0,3,0,0,0,67,0,
0,0,115,20,0,0,0,116,0,124,0,124,1,131,2,92,
3,125,2,125,3,125,4,124,2,83,0,41,1,122,163,103,
101,116,95,99,111,100,101,40,102,117,108,108,110,97,109,101,
41,32,45,62,32,99,111,100,101,32,111,98,106,101,99,116,
46,10,10,32,32,32,32,32,32,32,32,82,101,116,117,114,
110,32,116,104,101,32,99,111,100,101,32,111,98,106,101,99,
116,32,102,111,114,32,116,104,101,32,115,112,101,99,105,102,
105,101,100,32,109,111,100,117,108,101,46,32,82,97,105,115,
101,32,90,105,112,73,109,112,111,114,116,69,114,114,111,114,
10,32,32,32,32,32,32,32,32,105,102,32,116,104,101,32,
109,111,100,117,108,101,32,99,111,117,108,100,110,39,116,32,
98,101,32,102,111,117,110,100,46,10,32,32,32,32,32,32,
32,32,41,1,218,16,95,103,101,116,95,109,111,100,117,108,
101,95,99,111,100,101,41,5,114,30,0,0,0,114,36,0,
0,0,218,4,99,111,100,101,218,9,105,115,112,97,99,107,
97,103,101,114,38,0,0,0,114,9,0,0,0,114,9,0,
0,0,114,10,0,0,0,218,8,103,101,116,95,99,111,100,
101,150,0,0,0,115,4,0,0,0,0,6,16,1,122,20,
122,105,112,105,109,112,111,114,116,101,114,46,103,101,116,95,
99,111,100,101,99,2,0,0,0,0,0,0,0,4,0,0,
0,8,0,0,0,67,0,0,0,115,118,0,0,0,116,0,
114,16,124,1,160,1,116,0,116,2,161,2,125,1,124,1,
125,2,124,1,160,3,124,0,106,4,116,2,23,0,161,1,
114,58,124,1,116,5,124,0,106,4,116,2,23,0,131,1,
100,1,133,2,25,0,125,2,122,14,124,0,106,6,124,2,
25,0,125,3,87,0,110,32,4,0,116,7,107,10,114,104,
1,0,1,0,1,0,116,8,100,2,100,3,124,2,131,3,
130,1,89,0,110,2,88,0,116,9,124,0,106,4,124,3,
131,2,83,0,41,4,122,154,103,101,116,95,100,97,116,97,
40,112,97,116,104,110,97,109,101,41,32,45,62,32,115,116,
114,105,110,103,32,119,105,116,104,32,102,105,108,101,32,100,
97,116,97,46,10,10,32,32,32,32,32,32,32,32,82,101,
116,117,114,110,32,116,104,101,32,100,97,116,97,32,97,115,
115,111,99,105,97,116,101,100,32,119,105,116,104,32,39,112,
97,116,104,110,97,109,101,39,46,32,82,97,105,115,101,32,
79,83,69,114,114,111,114,32,105,102,10,32,32,32,32,32,
32,32,32,116,104,101,32,102,105,108,101,32,119,97,115,110,
39,116,32,102,111,117,110,100,46,10,32,32,32,32,32,32,
32,32,78,114,0,0,0,0,218,0,41,10,114,16,0,0,
0,114,17,0,0,0,114,18,0,0,0,218,10,115,116,97,
114,116,115,119,105,116,104,114,27,0,0,0,218,3,108,101,
110,114,26,0,0,0,114,24,0,0,0,114,20,0,0,0,
218,9,95,103,101,116,95,100,97,116,97,41,4,114,30,0,
0,0,218,8,112,97,116,104,110,97,109,101,90,3,107,101,
121,218,9,116,111,99,95,101,110,116,114,121,114,9,0,0,
0,114,9,0,0,0,114,10,0,0,0,218,8,103,101,116,
95,100,97,116,97,160,0,0,0,115,20,0,0,0,0,6,
4,1,12,2,4,1,16,1,22,2,2,1,14,1,14,1,
18,1,122,20,122,105,112,105,109,112,111,114,116,101,114,46,
103,101,116,95,100,97,116,97,99,2,0,0,0,0,0,0,
0,5,0,0,0,3,0,0,0,67,0,0,0,115,20,0,
0,0,116,0,124,0,124,1,131,2,92,3,125,2,125,3,
125,4,124,4,83,0,41,1,122,106,103,101,116,95,102,105,
108,101,110,97,109,101,40,102,117,108,108,110,97,109,101,41,
32,45,62,32,102,105,108,101,110,97,109,101,32,115,116,114,
105,110,103,46,10,10,32,32,32,32,32,32,32,32,82,101,
116,117,114,110,32,116,104,101,32,102,105,108,101,110,97,109,
101,32,102,111,114,32,116,104,101,32,115,112,101,99,105,102,
105,101,100,32,109,111,100,117,108,101,46,10,32,32,32,32,
32,32,32,32,41,1,114,41,0,0,0,41,5,114,30,0,
0,0,114,36,0,0,0,114,42,0,0,0,114,43,0,0,
0,114,38,0,0,0,114,9,0,0,0,114,9,0,0,0,
114,10,0,0,0,218,12,103,101,116,95,102,105,108,101,110,
97,109,101,181,0,0,0,115,4,0,0,0,0,7,16,1,
122,24,122,105,112,105,109,112,111,114,116,101,114,46,103,101,
116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0,
0,0,0,6,0,0,0,8,0,0,0,67,0,0,0,115,
128,0,0,0,116,0,124,0,124,1,131,2,125,2,124,2,
100,1,107,8,114,36,116,1,100,2,124,1,155,2,157,2,
124,1,100,3,141,2,130,1,116,2,124,0,124,1,131,2,
125,3,124,2,114,64,116,3,160,4,124,3,100,4,161,2,
125,4,110,10,124,3,155,0,100,5,157,2,125,4,122,14,
124,0,106,5,124,4,25,0,125,5,87,0,110,22,4,0,
116,6,107,10,114,110,1,0,1,0,1,0,89,0,100,1,
83,0,88,0,116,7,124,0,106,8,124,5,131,2,160,9,
161,0,83,0,41,6,122,253,103,101,116,95,115,111,117,114,
99,101,40,102,117,108,108,110,97,109,101,41,32,45,62,32,
115,111,117,114,99,101,32,115,116,114,105,110,103,46,10,10,
32,32,32,32,32,32,32,32,82,101,116,117,114,110,32,116,
104,101,32,115,111,117,114,99,101,32,99,111,100,101,32,102,
111,114,32,116,104,101,32,115,112,101,99,105,102,105,101,100,
32,109,111,100,117,108,101,46,32,82,97,105,115,101,32,90,
105,112,73,109,112,111,114,116,69,114,114,111,114,10,32,32,
32,32,32,32,32,32,105,102,32,116,104,101,32,109,111,100,
117,108,101,32,99,111,117,108,100,110,39,116,32,98,101,32,
102,111,117,110,100,44,32,114,101,116,117,114,110,32,78,111,
110,101,32,105,102,32,116,104,101,32,97,114,99,104,105,118,
101,32,100,111,101,115,10,32,32,32,32,32,32,32,32,99,
111,110,116,97,105,110,32,116,104,101,32,109,111,100,117,108,
101,44,32,98,117,116,32,104,97,115,32,110,111,32,115,111,
117,114,99,101,32,102,111,114,32,105,116,46,10,32,32,32,
32,32,32,32,32,78,122,18,99,97,110,39,116,32,102,105,
110,100,32,109,111,100,117,108,101,32,41,1,218,4,110,97,
109,101,122,11,95,95,105,110,105,116,95,95,46,112,121,122,
3,46,112,121,41,10,114,33,0,0,0,114,3,0,0,0,
114,34,0,0,0,114,19,0,0,0,114,28,0,0,0,114,
26,0,0,0,114,24,0,0,0,114,48,0,0,0,114,27,
0,0,0,218,6,100,101,99,111,100,101,41,6,114,30,0,
0,0,114,36,0,0,0,114,37,0,0,0,114,11,0,0,
0,218,8,102,117,108,108,112,97,116,104,114,50,0,0,0,
114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,
10,103,101,116,95,115,111,117,114,99,101,192,0,0,0,115,
24,0,0,0,0,7,10,1,8,1,18,2,10,1,4,1,
14,2,10,2,2,1,14,1,14,2,8,1,122,22,122,105,
112,105,109,112,111,114,116,101,114,46,103,101,116,95,115,111,
117,114,99,101,99,2,0,0,0,0,0,0,0,3,0,0,
0,4,0,0,0,67,0,0,0,115,40,0,0,0,116,0,
124,0,124,1,131,2,125,2,124,2,100,1,107,8,114,36,
116,1,100,2,124,1,155,2,157,2,124,1,100,3,141,2,
130,1,124,2,83,0,41,4,122,171,105,115,95,112,97,99,
107,97,103,101,40,102,117,108,108,110,97,109,101,41,32,45,
62,32,98,111,111,108,46,10,10,32,32,32,32,32,32,32,
32,82,101,116,117,114,110,32,84,114,117,101,32,105,102,32,
116,104,101,32,109,111,100,117,108,101,32,115,112,101,99,105,
102,105,101,100,32,98,121,32,102,117,108,108,110,97,109,101,
32,105,115,32,97,32,112,97,99,107,97,103,101,46,10,32,
32,32,32,32,32,32,32,82,97,105,115,101,32,90,105,112,
73,109,112,111,114,116,69,114,114,111,114,32,105,102,32,116,
104,101,32,109,111,100,117,108,101,32,99,111,117,108,100,110,
39,116,32,98,101,32,102,111,117,110,100,46,10,32,32,32,
32,32,32,32,32,78,122,18,99,97,110,39,116,32,102,105,
110,100,32,109,111,100,117,108,101,32,41,1,114,53,0,0,
0,41,2,114,33,0,0,0,114,3,0,0,0,41,3,114,
30,0,0,0,114,36,0,0,0,114,37,0,0,0,114,9,
0,0,0,114,9,0,0,0,114,10,0,0,0,218,10,105,
115,95,112,97,99,107,97,103,101,218,0,0,0,115,8,0,
0,0,0,6,10,1,8,1,18,1,122,22,122,105,112,105,
109,112,111,114,116,101,114,46,105,115,95,112,97,99,107,97,
103,101,99,2,0,0,0,0,0,0,0,8,0,0,0,8,
0,0,0,67,0,0,0,115,248,0,0,0,116,0,124,0,
124,1,131,2,92,3,125,2,125,3,125,4,116,1,106,2,
160,3,124,1,161,1,125,5,124,5,100,1,107,8,115,46,
116,4,124,5,116,5,131,2,115,64,116,5,124,1,131,1,
125,5,124,5,116,1,106,2,124,1,60,0,124,0,124,5,
95,6,122,84,124,3,114,108,116,7,124,0,124,1,131,2,
125,6,116,8,160,9,124,0,106,10,124,6,161,2,125,7,
124,7,103,1,124,5,95,11,116,12,124,5,100,2,131,2,
115,124,116,13,124,5,95,13,116,8,160,14,124,5,106,15,
124,1,124,4,161,3,1,0,116,16,124,2,124,5,106,15,
131,2,1,0,87,0,110,22,1,0,1,0,1,0,116,1,
106,2,124,1,61,0,130,0,89,0,110,2,88,0,122,14,
116,1,106,2,124,1,25,0,125,5,87,0,110,36,4,0,
116,17,107,10,114,228,1,0,1,0,1,0,116,18,100,3,
124,1,155,2,100,4,157,3,131,1,130,1,89,0,110,2,
88,0,116,19,160,20,100,5,124,1,124,4,161,3,1,0,
124,5,83,0,41,6,122,245,108,111,97,100,95,109,111,100,
117,108,101,40,102,117,108,108,110,97,109,101,41,32,45,62,
32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,32,
32,32,76,111,97,100,32,116,104,101,32,109,111,100,117,108,
101,32,115,112,101,99,105,102,105,101,100,32,98,121,32,39,
102,117,108,108,110,97,109,101,39,46,32,39,102,117,108,108,
110,97,109,101,39,32,109,117,115,116,32,98,101,32,116,104,
101,10,32,32,32,32,32,32,32,32,102,117,108,108,121,32,
113,117,97,108,105,102,105,101,100,32,40,100,111,116,116,101,
100,41,32,109,111,100,117,108,101,32,110,97,109,101,46,32,
73,116,32,114,101,116,117,114,110,115,32,116,104,101,32,105,
109,112,111,114,116,101,100,10,32,32,32,32,32,32,32,32,
109,111,100,117,108,101,44,32,111,114,32,114,97,105,115,101,
115,32,90,105,112,73,109,112,111,114,116,69,114,114,111,114,
32,105,102,32,105,116,32,119,97,115,110,39,116,32,102,111,
117,110,100,46,10,32,32,32,32,32,32,32,32,78,218,12,
95,95,98,117,105,108,116,105,110,115,95,95,122,14,76,111,
97,100,101,100,32,109,111,100,117,108,101,32,122,25,32,110,
111,116,32,102,111,117,110,100,32,105,110,32,115,121,115,46,
109,111,100,117,108,101,115,122,30,105,109,112,111,114,116,32,
123,125,32,35,32,108,111,97,100,101,100,32,102,114,111,109,
32,90,105,112,32,123,125,41,21,114,41,0,0,0,218,3,
115,121,115,218,7,109,111,100,117,108,101,115,218,3,103,101,
116,114,13,0,0,0,218,12,95,109,111,100,117,108,101,95,
116,121,112,101,218,10,95,95,108,111,97,100,101,114,95,95,
114,34,0,0,0,114,19,0,0,0,114,28,0,0,0,114,
27,0,0,0,90,8,95,95,112,97,116,104,95,95,218,7,
104,97,115,97,116,116,114,114,58,0,0,0,90,14,95,102,
105,120,95,117,112,95,109,111,100,117,108,101,218,8,95,95,
100,105,99,116,95,95,218,4,101,120,101,99,114,24,0,0,
0,218,11,73,109,112,111,114,116,69,114,114,111,114,218,10,
95,98,111,111,116,115,116,114,97,112,218,16,95,118,101,114,
98,111,115,101,95,109,101,115,115,97,103,101,41,8,114,30,
0,0,0,114,36,0,0,0,114,42,0,0,0,114,43,0,
0,0,114,38,0,0,0,90,3,109,111,100,114,11,0,0,
0,114,55,0,0,0,114,9,0,0,0,114,9,0,0,0,
114,10,0,0,0,218,11,108,111,97,100,95,109,111,100,117,
108,101,231,0,0,0,115,48,0,0,0,0,7,16,1,12,
1,18,1,8,1,10,1,6,2,2,1,4,3,10,1,14,
1,8,2,10,1,6,1,16,1,16,1,6,1,8,1,8,
2,2,1,14,1,14,1,22,1,14,1,122,23,122,105,112,
105,109,112,111,114,116,101,114,46,108,111,97,100,95,109,111,
100,117,108,101,99,2,0,0,0,0,0,0,0,3,0,0,
0,4,0,0,0,67,0,0,0,115,24,0,0,0,100,1,
100,2,108,0,109,1,125,2,1,0,124,2,160,2,124,0,
124,1,161,2,83,0,41,3,122,204,82,101,116,117,114,110,
32,116,104,101,32,82,101,115,111,117,114,99,101,82,101,97,
100,101,114,32,102,111,114,32,97,32,112,97,99,107,97,103,
101,32,105,110,32,97,32,122,105,112,32,102,105,108,101,46,
10,10,32,32,32,32,32,32,32,32,73,102,32,39,102,117,
108,108,110,97,109,101,39,32,105,115,32,97,32,112,97,99,
107,97,103,101,32,119,105,116,104,105,110,32,116,104,101,32,
122,105,112,32,102,105,108,101,44,32,114,101,116,117,114,110,
32,116,104,101,10,32,32,32,32,32,32,32,32,39,82,101,
115,111,117,114,99,101,82,101,97,100,101,114,39,32,111,98,
106,101,99,116,32,102,111,114,32,116,104,101,32,112,97,99,
107,97,103,101,46,32,32,79,116,104,101,114,119,105,115,101,
32,114,101,116,117,114,110,32,78,111,110,101,46,10,32,32,
32,32,32,32,32,32,114,0,0,0,0,41,1,218,9,114,
101,115,111,117,114,99,101,115,41,3,90,9,105,109,112,111,
114,116,108,105,98,114,71,0,0,0,90,30,95,122,105,112,
105,109,112,111,114,116,95,103,101,116,95,114,101,115,111,117,
114,99,101,95,114,101,97,100,101,114,41,3,114,30,0,0,
0,114,36,0,0,0,114,71,0,0,0,114,9,0,0,0,
114,9,0,0,0,114,10,0,0,0,218,19,103,101,116,95,
114,101,115,111,117,114,99,101,95,114,101,97,100,101,114,13,
1,0,0,115,4,0,0,0,0,6,12,1,122,31,122,105,
112,105,109,112,111,114,116,101,114,46,103,101,116,95,114,101,
115,111,117,114,99,101,95,114,101,97,100,101,114,99,1,0,
0,0,0,0,0,0,1,0,0,0,5,0,0,0,67,0,
0,0,115,24,0,0,0,100,1,124,0,106,0,155,0,116,
1,155,0,124,0,106,2,155,0,100,2,157,5,83,0,41,
3,78,122,21,60,122,105,112,105,109,112,111,114,116,101,114,
32,111,98,106,101,99,116,32,34,122,2,34,62,41,3,114,
27,0,0,0,114,18,0,0,0,114,29,0,0,0,41,1,
114,30,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
10,0,0,0,218,8,95,95,114,101,112,114,95,95,23,1,
0,0,115,2,0,0,0,0,1,122,20,122,105,112,105,109,
112,111,114,116,101,114,46,95,95,114,101,112,114,95,95,41,
1,78,41,1,78,41,15,114,6,0,0,0,114,7,0,0,
0,114,8,0,0,0,218,7,95,95,100,111,99,95,95,114,
32,0,0,0,114,39,0,0,0,114,40,0,0,0,114,44,
0,0,0,114,51,0,0,0,114,52,0,0,0,114,56,0,
0,0,114,57,0,0,0,114,70,0,0,0,114,72,0,0,
0,114,73,0,0,0,114,9,0,0,0,114,9,0,0,0,
114,9,0,0,0,114,10,0,0,0,114,4,0,0,0,42,
0,0,0,115,24,0,0,0,8,13,4,5,8,46,10,32,
10,12,8,10,8,21,8,11,8,26,8,13,8,38,8,10,
122,12,95,95,105,110,105,116,95,95,46,112,121,99,84,122,
11,95,95,105,110,105,116,95,95,46,112,121,70,41,3,122,
4,46,112,121,99,84,70,41,3,122,3,46,112,121,70,70,
99,2,0,0,0,0,0,0,0,2,0,0,0,4,0,0,
0,67,0,0,0,115,20,0,0,0,124,0,106,0,124,1,
160,1,100,1,161,1,100,2,25,0,23,0,83,0,41,3,
78,218,1,46,233,2,0,0,0,41,2,114,29,0,0,0,
218,10,114,112,97,114,116,105,116,105,111,110,41,2,114,30,
0,0,0,114,36,0,0,0,114,9,0,0,0,114,9,0,
0,0,114,10,0,0,0,114,34,0,0,0,41,1,0,0,
115,2,0,0,0,0,1,114,34,0,0,0,99,2,0,0,
0,0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,
0,115,18,0,0,0,124,1,116,0,23,0,125,2,124,2,
124,0,106,1,107,6,83,0,41,1,78,41,2,114,18,0,
0,0,114,26,0,0,0,41,3,114,30,0,0,0,114,11,
0,0,0,90,7,100,105,114,112,97,116,104,114,9,0,0,
0,114,9,0,0,0,114,10,0,0,0,114,35,0,0,0,
45,1,0,0,115,4,0,0,0,0,4,8,2,114,35,0,
0,0,99,2,0,0,0,0,0,0,0,7,0,0,0,4,
0,0,0,67,0,0,0,115,56,0,0,0,116,0,124,0,
124,1,131,2,125,2,116,1,68,0,93,36,92,3,125,3,
125,4,125,5,124,2,124,3,23,0,125,6,124,6,124,0,
106,2,107,6,114,14,124,5,2,0,1,0,83,0,113,14,
100,0,83,0,41,1,78,41,3,114,34,0,0,0,218,16,
95,122,105,112,95,115,101,97,114,99,104,111,114,100,101,114,
114,26,0,0,0,41,7,114,30,0,0,0,114,36,0,0,
0,114,11,0,0,0,218,6,115,117,102,102,105,120,218,10,
105,115,98,121,116,101,99,111,100,101,114,43,0,0,0,114,
55,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,
0,0,0,114,33,0,0,0,54,1,0,0,115,12,0,0,
0,0,1,10,1,14,1,8,1,10,1,10,1,114,33,0,
0,0,99,1,0,0,0,0,0,0,0,23,0,0,0,9,
0,0,0,67,0,0,0,115,20,4,0,0,122,16,116,0,
160,1,124,0,100,1,161,2,125,1,87,0,110,38,4,0,
116,2,107,10,114,54,1,0,1,0,1,0,116,3,100,2,
124,0,155,2,157,2,124,0,100,3,141,2,130,1,89,0,
110,2,88,0,124,1,144,3,143,190,1,0,122,34,124,1,
160,4,100,4,100,5,161,2,1,0,124,1,160,5,161,0,
125,2,124,1,160,6,100,6,161,1,125,3,87,0,110,38,
4,0,116,2,107,10,114,136,1,0,1,0,1,0,116,3,
100,7,124,0,155,2,157,2,124,0,100,3,141,2,130,1,
89,0,110,2,88,0,116,7,124,3,131,1,100,6,107,3,
114,168,116,3,100,7,124,0,155,2,157,2,124,0,100,3,
141,2,130,1,124,3,100,0,100,8,133,2,25,0,100,9,
107,3,114,202,116,3,100,10,124,0,155,2,157,2,124,0,
100,3,141,2,130,1,116,8,124,3,100,11,100,12,133,2,
25,0,131,1,125,4,116,8,124,3,100,12,100,13,133,2,
25,0,131,1,125,5,124,2,124,4,107,0,144,1,114,6,
116,3,100,14,124,0,155,2,157,2,124,0,100,3,141,2,
130,1,124,2,124,5,107,0,144,1,114,34,116,3,100,15,
124,0,155,2,157,2,124,0,100,3,141,2,130,1,124,2,
124,4,56,0,125,2,124,2,124,5,24,0,125,6,124,6,
100,16,107,0,144,1,114,78,116,3,100,17,124,0,155,2,
157,2,124,0,100,3,141,2,130,1,105,0,125,7,100,16,
125,8,122,14,124,1,160,4,124,2,161,1,1,0,87,0,
110,40,4,0,116,2,107,10,144,1,114,140,1,0,1,0,
1,0,116,3,100,7,124,0,155,2,157,2,124,0,100,3,
141,2,130,1,89,0,110,2,88,0,124,1,160,6,100,18,
161,1,125,3,116,7,124,3,131,1,100,8,107,0,144,1,
114,174,116,9,100,19,131,1,130,1,124,3,100,0,100,8,
133,2,25,0,100,20,107,3,144,1,114,196,144,3,113,248,
116,7,124,3,131,1,100,18,107,3,144,1,114,218,116,9,
100,19,131,1,130,1,116,10,124,3,100,21,100,22,133,2,
25,0,131,1,125,9,116,10,124,3,100,22,100,11,133,2,
25,0,131,1,125,10,116,10,124,3,100,11,100,23,133,2,
25,0,131,1,125,11,116,10,124,3,100,23,100,12,133,2,
25,0,131,1,125,12,116,8,124,3,100,12,100,13,133,2,
25,0,131,1,125,13,116,8,124,3,100,13,100,24,133,2,
25,0,131,1,125,14,116,8,124,3,100,24,100,25,133,2,
25,0,131,1,125,15,116,10,124,3,100,25,100,26,133,2,
25,0,131,1,125,16,116,10,124,3,100,26,100,27,133,2,
25,0,131,1,125,17,116,10,124,3,100,27,100,28,133,2,
25,0,131,1,125,18,116,8,124,3,100,29,100,18,133,2,
25,0,131,1,125,19,124,16,124,17,23,0,124,18,23,0,
125,4,124,19,124,5,107,4,144,2,114,178,116,3,100,30,
124,0,155,2,157,2,124,0,100,3,141,2,130,1,124,19,
124,6,55,0,125,19,122,14,124,1,160,6,124,16,161,1,
125,20,87,0,110,40,4,0,116,2,107,10,144,2,114,240,
1,0,1,0,1,0,116,3,100,7,124,0,155,2,157,2,
124,0,100,3,141,2,130,1,89,0,110,2,88,0,116,7,
124,20,131,1,124,16,107,3,144,3,114,18,116,3,100,7,
124,0,155,2,157,2,124,0,100,3,141,2,130,1,122,50,
116,7,124,1,160,6,124,4,124,16,24,0,161,1,131,1,
124,4,124,16,24,0,107,3,144,3,114,66,116,3,100,7,
124,0,155,2,157,2,124,0,100,3,141,2,130,1,87,0,
110,40,4,0,116,2,107,10,144,3,114,108,1,0,1,0,
1,0,116,3,100,7,124,0,155,2,157,2,124,0,100,3,
141,2,130,1,89,0,110,2,88,0,124,9,100,31,64,0,
144,3,114,130,124,20,160,11,161,0,125,20,110,54,122,14,
124,20,160,11,100,32,161,1,125,20,87,0,110,38,4,0,
116,12,107,10,144,3,114,182,1,0,1,0,1,0,124,20,
160,11,100,33,161,1,160,13,116,14,161,1,125,20,89,0,
110,2,88,0,124,20,160,15,100,34,116,16,161,2,125,20,
116,17,160,18,124,0,124,20,161,2,125,21,124,21,124,10,
124,14,124,15,124,19,124,11,124,12,124,13,102,8,125,22,
124,22,124,7,124,20,60,0,124,8,100,35,55,0,125,8,
144,1,113,142,87,0,53,0,81,0,82,0,88,0,116,19,
160,20,100,36,124,8,124,0,161,3,1,0,124,7,83,0,
41,37,78,218,2,114,98,122,21,99,97,110,39,116,32,111,
112,101,110,32,90,105,112,32,102,105,108,101,58,32,41,1,
114,11,0,0,0,105,234,255,255,255,114,76,0,0,0,233,
22,0,0,0,122,21,99,97,110,39,116,32,114,101,97,100,
32,90,105,112,32,102,105,108,101,58,32,233,4,0,0,0,
115,4,0,0,0,80,75,5,6,122,16,110,111,116,32,97,
32,90,105,112,32,102,105,108,101,58,32,233,12,0,0,0,
233,16,0,0,0,233,20,0,0,0,122,28,98,97,100,32,
99,101,110,116,114,97,108,32,100,105,114,101,99,116,111,114,
121,32,115,105,122,101,58,32,122,30,98,97,100,32,99,101,
110,116,114,97,108,32,100,105,114,101,99,116,111,114,121,32,
111,102,102,115,101,116,58,32,114,0,0,0,0,122,38,98,
97,100,32,99,101,110,116,114,97,108,32,100,105,114,101,99,
116,111,114,121,32,115,105,122,101,32,111,114,32,111,102,102,
115,101,116,58,32,233,46,0,0,0,122,27,69,79,70,32,
114,101,97,100,32,119,104,101,114,101,32,110,111,116,32,101,
120,112,101,99,116,101,100,115,4,0,0,0,80,75,1,2,
233,8,0,0,0,233,10,0,0,0,233,14,0,0,0,233,
24,0,0,0,233,28,0,0,0,233,30,0,0,0,233,32,
0,0,0,233,34,0,0,0,233,42,0,0,0,122,25,98,
97,100,32,108,111,99,97,108,32,104,101,97,100,101,114,32,
111,102,102,115,101,116,58,32,105,0,8,0,0,218,5,97,
115,99,105,105,90,6,108,97,116,105,110,49,250,1,47,114,
5,0,0,0,122,33,122,105,112,105,109,112,111,114,116,58,
32,102,111,117,110,100,32,123,125,32,110,97,109,101,115,32,
105,110,32,123,33,114,125,41,21,218,3,95,105,111,218,4,
111,112,101,110,114,20,0,0,0,114,3,0,0,0,218,4,
115,101,101,107,90,4,116,101,108,108,218,4,114,101,97,100,
114,47,0,0,0,114,2,0,0,0,218,8,69,79,70,69,
114,114,111,114,114,1,0,0,0,114,54,0,0,0,218,18,
85,110,105,99,111,100,101,68,101,99,111,100,101,69,114,114,
111,114,218,9,116,114,97,110,115,108,97,116,101,218,11,99,
112,52,51,55,95,116,97,98,108,101,114,17,0,0,0,114,
18,0,0,0,114,19,0,0,0,114,28,0,0,0,114,68,
0,0,0,114,69,0,0,0,41,23,114,27,0,0,0,218,
2,102,112,90,15,104,101,97,100,101,114,95,112,111,115,105,
116,105,111,110,218,6,98,117,102,102,101,114,218,11,104,101,
97,100,101,114,95,115,105,122,101,90,13,104,101,97,100,101,
114,95,111,102,102,115,101,116,90,10,97,114,99,95,111,102,
102,115,101,116,114,31,0,0,0,218,5,99,111,117,110,116,
218,5,102,108,97,103,115,218,8,99,111,109,112,114,101,115,
115,218,4,116,105,109,101,218,4,100,97,116,101,218,3,99,
114,99,218,9,100,97,116,97,95,115,105,122,101,218,9,102,
105,108,101,95,115,105,122,101,218,9,110,97,109,101,95,115,
105,122,101,218,10,101,120,116,114,97,95,115,105,122,101,90,
12,99,111,109,109,101,110,116,95,115,105,122,101,218,11,102,
105,108,101,95,111,102,102,115,101,116,114,53,0,0,0,114,
11,0,0,0,218,1,116,114,9,0,0,0,114,9,0,0,
0,114,10,0,0,0,114,25,0,0,0,85,1,0,0,115,
154,0,0,0,0,1,2,1,16,1,14,1,24,2,8,1,
2,1,12,1,8,1,14,1,14,1,24,1,12,1,18,1,
16,2,18,2,16,1,16,1,10,1,18,1,10,1,18,1,
8,1,8,1,10,1,18,2,4,2,4,1,2,1,14,1,
16,1,24,2,10,1,14,1,8,2,18,1,4,1,14,1,
8,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,
16,1,16,1,16,1,16,1,12,1,10,1,18,1,8,2,
2,1,14,1,16,1,24,1,14,1,18,4,2,1,28,1,
22,1,16,1,24,2,10,2,10,3,2,1,14,1,16,1,
22,2,12,1,12,1,20,1,8,1,22,1,14,1,114,25,
0,0,0,117,190,1,0,0,0,1,2,3,4,5,6,7,
8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,
56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,
72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,
104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126,127,195,135,195,188,195,169,195,162,
195,164,195,160,195,165,195,167,195,170,195,171,195,168,195,175,
195,174,195,172,195,132,195,133,195,137,195,166,195,134,195,180,
195,182,195,178,195,187,195,185,195,191,195,150,195,156,194,162,
194,163,194,165,226,130,167,198,146,195,161,195,173,195,179,195,
186,195,177,195,145,194,170,194,186,194,191,226,140,144,194,172,
194,189,194,188,194,161,194,171,194,187,226,150,145,226,150,146,
226,150,147,226,148,130,226,148,164,226,149,161,226,149,162,226,
149,150,226,149,149,226,149,163,226,149,145,226,149,151,226,149,
157,226,149,156,226,149,155,226,148,144,226,148,148,226,148,180,
226,148,172,226,148,156,226,148,128,226,148,188,226,149,158,226,
149,159,226,149,154,226,149,148,226,149,169,226,149,166,226,149,
160,226,149,144,226,149,172,226,149,167,226,149,168,226,149,164,
226,149,165,226,149,153,226,149,152,226,149,146,226,149,147,226,
149,171,226,149,170,226,148,152,226,148,140,226,150,136,226,150,
132,226,150,140,226,150,144,226,150,128,206,177,195,159,206,147,
207,128,206,163,207,131,194,181,207,132,206,166,206,152,206,169,
206,180,226,136,158,207,134,206,181,226,136,169,226,137,161,194,
177,226,137,165,226,137,164,226,140,160,226,140,161,195,183,226,
137,136,194,176,226,136,153,194,183,226,136,154,226,129,191,194,
178,226,150,160,194,160,99,0,0,0,0,0,0,0,0,1,
0,0,0,8,0,0,0,67,0,0,0,115,108,0,0,0,
116,0,114,22,116,1,160,2,100,1,161,1,1,0,116,3,
100,2,131,1,130,1,100,3,97,0,122,60,122,16,100,4,
100,5,108,4,109,5,125,0,1,0,87,0,110,38,4,0,
116,6,107,10,114,82,1,0,1,0,1,0,116,1,160,2,
100,1,161,1,1,0,116,3,100,2,131,1,130,1,89,0,
110,2,88,0,87,0,53,0,100,6,97,0,88,0,116,1,
160,2,100,7,161,1,1,0,124,0,83,0,41,8,78,122,
27,122,105,112,105,109,112,111,114,116,58,32,122,108,105,98,
32,85,78,65,86,65,73,76,65,66,76,69,122,41,99,97,
110,39,116,32,100,101,99,111,109,112,114,101,115,115,32,100,
97,116,97,59,32,122,108,105,98,32,110,111,116,32,97,118,
97,105,108,97,98,108,101,84,114,0,0,0,0,41,1,218,
10,100,101,99,111,109,112,114,101,115,115,70,122,25,122,105,
112,105,109,112,111,114,116,58,32,122,108,105,98,32,97,118,
97,105,108,97,98,108,101,41,7,218,15,95,105,109,112,111,
114,116,105,110,103,95,122,108,105,98,114,68,0,0,0,114,
69,0,0,0,114,3,0,0,0,90,4,122,108,105,98,114,
122,0,0,0,218,9,69,120,99,101,112,116,105,111,110,41,
1,114,122,0,0,0,114,9,0,0,0,114,9,0,0,0,
114,10,0,0,0,218,20,95,103,101,116,95,100,101,99,111,
109,112,114,101,115,115,95,102,117,110,99,220,1,0,0,115,
24,0,0,0,0,2,4,3,10,1,8,2,4,1,4,1,
16,1,14,1,10,1,18,2,6,2,10,1,114,125,0,0,
0,99,2,0,0,0,0,0,0,0,17,0,0,0,9,0,
0,0,67,0,0,0,115,130,1,0,0,124,1,92,8,125,
2,125,3,125,4,125,5,125,6,125,7,125,8,125,9,124,
4,100,1,107,0,114,36,116,0,100,2,131,1,130,1,116,
1,160,2,124,0,100,3,161,2,144,1,143,8,125,10,122,
14,124,10,160,3,124,6,161,1,1,0,87,0,110,38,4,
0,116,4,107,10,114,104,1,0,1,0,1,0,116,0,100,
4,124,0,155,2,157,2,124,0,100,5,141,2,130,1,89,
0,110,2,88,0,124,10,160,5,100,6,161,1,125,11,116,
6,124,11,131,1,100,6,107,3,114,136,116,7,100,7,131,
1,130,1,124,11,100,0,100,8,133,2,25,0,100,9,107,
3,114,170,116,0,100,10,124,0,155,2,157,2,124,0,100,
5,141,2,130,1,116,8,124,11,100,11,100,12,133,2,25,
0,131,1,125,12,116,8,124,11,100,12,100,6,133,2,25,
0,131,1,125,13,100,6,124,12,23,0,124,13,23,0,125,
14,124,6,124,14,55,0,125,6,122,14,124,10,160,3,124,
6,161,1,1,0,87,0,110,40,4,0,116,4,107,10,144,
1,114,20,1,0,1,0,1,0,116,0,100,4,124,0,155,
2,157,2,124,0,100,5,141,2,130,1,89,0,110,2,88,
0,124,10,160,5,124,4,161,1,125,15,116,6,124,15,131,
1,124,4,107,3,144,1,114,54,116,4,100,13,131,1,130,
1,87,0,53,0,81,0,82,0,88,0,124,3,100,1,107,
2,144,1,114,78,124,15,83,0,122,10,116,9,131,0,125,
16,87,0,110,30,4,0,116,10,107,10,144,1,114,118,1,
0,1,0,1,0,116,0,100,14,131,1,130,1,89,0,110,
2,88,0,124,16,124,15,100,15,131,2,83,0,41,16,78,
114,0,0,0,0,122,18,110,101,103,97,116,105,118,101,32,
100,97,116,97,32,115,105,122,101,114,81,0,0,0,122,21,
99,97,110,39,116,32,114,101,97,100,32,90,105,112,32,102,
105,108,101,58,32,41,1,114,11,0,0,0,114,93,0,0,
0,122,27,69,79,70,32,114,101,97,100,32,119,104,101,114,
101,32,110,111,116,32,101,120,112,101,99,116,101,100,114,83,
0,0,0,115,4,0,0,0,80,75,3,4,122,23,98,97,
100,32,108,111,99,97,108,32,102,105,108,101,32,104,101,97,
100,101,114,58,32,233,26,0,0,0,114,92,0,0,0,122,
26,122,105,112,105,109,112,111,114,116,58,32,99,97,110,39,
116,32,114,101,97,100,32,100,97,116,97,122,41,99,97,110,
39,116,32,100,101,99,111,109,112,114,101,115,115,32,100,97,
116,97,59,32,122,108,105,98,32,110,111,116,32,97,118,97,
105,108,97,98,108,101,105,241,255,255,255,41,11,114,3,0,
0,0,114,99,0,0,0,114,100,0,0,0,114,101,0,0,
0,114,20,0,0,0,114,102,0,0,0,114,47,0,0,0,
114,103,0,0,0,114,1,0,0,0,114,125,0,0,0,114,
124,0,0,0,41,17,114,27,0,0,0,114,50,0,0,0,
90,8,100,97,116,97,112,97,116,104,114,112,0,0,0,114,
116,0,0,0,114,117,0,0,0,114,120,0,0,0,114,113,
0,0,0,114,114,0,0,0,114,115,0,0,0,114,107,0,
0,0,114,108,0,0,0,114,118,0,0,0,114,119,0,0,
0,114,109,0,0,0,90,8,114,97,119,95,100,97,116,97,
114,122,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
10,0,0,0,114,48,0,0,0,241,1,0,0,115,62,0,
0,0,0,1,20,1,8,1,8,2,16,2,2,1,14,1,
14,1,24,1,10,1,12,1,8,2,16,2,18,2,16,1,
16,1,12,1,8,1,2,1,14,1,16,1,24,1,10,1,
14,1,18,2,10,2,4,3,2,1,10,1,16,1,14,1,
114,48,0,0,0,99,2,0,0,0,0,0,0,0,2,0,
0,0,3,0,0,0,67,0,0,0,115,16,0,0,0,116,
0,124,0,124,1,24,0,131,1,100,1,107,1,83,0,41,
2,78,114,5,0,0,0,41,1,218,3,97,98,115,41,2,
90,2,116,49,90,2,116,50,114,9,0,0,0,114,9,0,
0,0,114,10,0,0,0,218,9,95,101,113,95,109,116,105,
109,101,31,2,0,0,115,2,0,0,0,0,2,114,128,0,
0,0,99,3,0,0,0,0,0,0,0,5,0,0,0,5,
0,0,0,67,0,0,0,115,206,0,0,0,116,0,124,1,
131,1,100,1,107,0,114,20,116,1,100,2,131,1,130,1,
124,1,100,0,100,3,133,2,25,0,116,2,106,3,107,3,
114,54,116,4,160,5,100,4,124,0,161,2,1,0,100,0,
83,0,116,6,124,1,100,3,100,5,133,2,25,0,131,1,
125,3,124,3,100,6,107,3,114,112,116,7,106,8,100,7,
107,3,114,110,124,3,100,8,107,3,115,106,116,7,106,8,
100,9,107,2,114,110,100,0,83,0,110,46,124,2,100,6,
107,3,114,158,116,9,116,6,124,1,100,5,100,10,133,2,
25,0,131,1,124,2,131,2,115,158,116,4,160,5,100,11,
124,0,161,2,1,0,100,0,83,0,116,10,160,11,124,1,
100,1,100,0,133,2,25,0,161,1,125,4,116,12,124,4,
116,13,131,2,115,202,116,14,100,12,124,0,155,2,100,13,
157,3,131,1,130,1,124,4,83,0,41,14,78,114,85,0,
0,0,122,12,98,97,100,32,112,121,99,32,100,97,116,97,
114,83,0,0,0,122,18,123,33,114,125,32,104,97,115,32,
98,97,100,32,109,97,103,105,99,114,88,0,0,0,114,0,
0,0,0,90,5,110,101,118,101,114,114,5,0,0,0,90,
6,97,108,119,97,121,115,114,84,0,0,0,122,18,123,33,
114,125,32,104,97,115,32,98,97,100,32,109,116,105,109,101,
122,16,99,111,109,112,105,108,101,100,32,109,111,100,117,108,
101,32,122,21,32,105,115,32,110,111,116,32,97,32,99,111,
100,101,32,111,98,106,101,99,116,41,15,114,47,0,0,0,
114,3,0,0,0,114,19,0,0,0,90,12,77,65,71,73,
67,95,78,85,77,66,69,82,114,68,0,0,0,114,69,0,
0,0,114,2,0,0,0,218,4,95,105,109,112,90,21,99,
104,101,99,107,95,104,97,115,104,95,98,97,115,101,100,95,
112,121,99,115,114,128,0,0,0,218,7,109,97,114,115,104,
97,108,90,5,108,111,97,100,115,114,13,0,0,0,218,10,
95,99,111,100,101,95,116,121,112,101,218,9,84,121,112,101,
69,114,114,111,114,41,5,114,49,0,0,0,218,4,100,97,
116,97,218,5,109,116,105,109,101,114,111,0,0,0,114,42,
0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,
0,0,218,15,95,117,110,109,97,114,115,104,97,108,95,99,
111,100,101,39,2,0,0,115,40,0,0,0,0,1,12,1,
8,2,18,1,12,1,4,2,16,1,8,5,10,1,6,255,
2,1,8,255,2,2,6,1,30,1,12,1,4,4,18,1,
10,1,16,1,114,135,0,0,0,99,1,0,0,0,0,0,
0,0,1,0,0,0,4,0,0,0,67,0,0,0,115,28,
0,0,0,124,0,160,0,100,1,100,2,161,2,125,0,124,
0,160,0,100,3,100,2,161,2,125,0,124,0,83,0,41,
4,78,115,2,0,0,0,13,10,243,1,0,0,0,10,243,
1,0,0,0,13,41,1,114,17,0,0,0,41,1,218,6,
115,111,117,114,99,101,114,9,0,0,0,114,9,0,0,0,
114,10,0,0,0,218,23,95,110,111,114,109,97,108,105,122,
101,95,108,105,110,101,95,101,110,100,105,110,103,115,72,2,
0,0,115,6,0,0,0,0,1,12,1,12,1,114,139,0,
0,0,99,2,0,0,0,0,0,0,0,2,0,0,0,6,
0,0,0,67,0,0,0,115,24,0,0,0,116,0,124,1,
131,1,125,1,116,1,124,1,124,0,100,1,100,2,100,3,
141,4,83,0,41,4,78,114,66,0,0,0,84,41,1,90,
12,100,111,110,116,95,105,110,104,101,114,105,116,41,2,114,
139,0,0,0,218,7,99,111,109,112,105,108,101,41,2,114,
49,0,0,0,114,138,0,0,0,114,9,0,0,0,114,9,
0,0,0,114,10,0,0,0,218,15,95,99,111,109,112,105,
108,101,95,115,111,117,114,99,101,79,2,0,0,115,4,0,
0,0,0,1,8,1,114,141,0,0,0,99,2,0,0,0,
0,0,0,0,2,0,0,0,11,0,0,0,67,0,0,0,
115,68,0,0,0,116,0,160,1,124,0,100,1,63,0,100,
2,23,0,124,0,100,3,63,0,100,4,64,0,124,0,100,
5,64,0,124,1,100,6,63,0,124,1,100,3,63,0,100,
7,64,0,124,1,100,5,64,0,100,8,20,0,100,9,100,
9,100,9,102,9,161,1,83,0,41,10,78,233,9,0,0,
0,105,188,7,0,0,233,5,0,0,0,233,15,0,0,0,
233,31,0,0,0,233,11,0,0,0,233,63,0,0,0,114,
76,0,0,0,114,12,0,0,0,41,2,114,113,0,0,0,
90,6,109,107,116,105,109,101,41,2,218,1,100,114,121,0,
0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,
0,218,14,95,112,97,114,115,101,95,100,111,115,116,105,109,
101,85,2,0,0,115,24,0,0,0,0,1,4,1,10,1,
10,1,6,1,6,1,10,1,10,1,2,0,2,0,2,250,
2,255,114,149,0,0,0,99,2,0,0,0,0,0,0,0,
5,0,0,0,10,0,0,0,67,0,0,0,115,104,0,0,
0,122,70,124,1,100,1,100,0,133,2,25,0,100,2,107,
6,115,22,116,0,130,1,124,1,100,0,100,1,133,2,25,
0,125,1,124,0,106,1,124,1,25,0,125,2,124,2,100,
3,25,0,125,3,124,2,100,4,25,0,125,4,116,2,124,
4,124,3,131,2,87,0,83,0,4,0,116,3,116,4,116,
5,102,3,107,10,114,98,1,0,1,0,1,0,89,0,100,
5,83,0,88,0,100,0,83,0,41,6,78,114,12,0,0,
0,41,2,218,1,99,218,1,111,114,143,0,0,0,233,6,
0,0,0,114,0,0,0,0,41,6,218,14,65,115,115,101,
114,116,105,111,110,69,114,114,111,114,114,26,0,0,0,114,
149,0,0,0,114,24,0,0,0,218,10,73,110,100,101,120,
69,114,114,111,114,114,132,0,0,0,41,5,114,30,0,0,
0,114,11,0,0,0,114,50,0,0,0,114,113,0,0,0,
114,114,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
10,0,0,0,218,20,95,103,101,116,95,109,116,105,109,101,
95,111,102,95,115,111,117,114,99,101,98,2,0,0,115,18,
0,0,0,0,1,2,2,20,1,12,1,10,3,8,1,8,
1,12,1,20,1,114,155,0,0,0,99,2,0,0,0,0,
0,0,0,12,0,0,0,9,0,0,0,67,0,0,0,115,
204,0,0,0,116,0,124,0,124,1,131,2,125,2,116,1,
68,0,93,166,92,3,125,3,125,4,125,5,124,2,124,3,
23,0,125,6,116,2,106,3,100,1,124,0,106,4,116,5,
124,6,100,2,100,3,141,5,1,0,122,14,124,0,106,6,
124,6,25,0,125,7,87,0,110,20,4,0,116,7,107,10,
114,88,1,0,1,0,1,0,89,0,113,14,88,0,124,7,
100,4,25,0,125,8,116,8,124,0,106,4,124,7,131,2,
125,9,124,4,114,138,116,9,124,0,124,6,131,2,125,10,
116,10,124,8,124,9,124,10,131,3,125,11,110,10,116,11,
124,8,124,9,131,2,125,11,124,11,100,0,107,8,114,158,
113,14,124,7,100,4,25,0,125,8,124,11,124,5,124,8,
102,3,2,0,1,0,83,0,113,14,116,12,100,5,124,1,
155,2,157,2,124,1,100,6,141,2,130,1,100,0,83,0,
41,7,78,122,13,116,114,121,105,110,103,32,123,125,123,125,
123,125,114,76,0,0,0,41,1,90,9,118,101,114,98,111,
115,105,116,121,114,0,0,0,0,122,18,99,97,110,39,116,
32,102,105,110,100,32,109,111,100,117,108,101,32,41,1,114,
53,0,0,0,41,13,114,34,0,0,0,114,78,0,0,0,
114,68,0,0,0,114,69,0,0,0,114,27,0,0,0,114,
18,0,0,0,114,26,0,0,0,114,24,0,0,0,114,48,
0,0,0,114,155,0,0,0,114,135,0,0,0,114,141,0,
0,0,114,3,0,0,0,41,12,114,30,0,0,0,114,36,
0,0,0,114,11,0,0,0,114,79,0,0,0,114,80,0,
0,0,114,43,0,0,0,114,55,0,0,0,114,50,0,0,
0,114,38,0,0,0,114,133,0,0,0,114,134,0,0,0,
114,42,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
10,0,0,0,114,41,0,0,0,114,2,0,0,115,38,0,
0,0,0,1,10,1,14,1,8,1,22,1,2,1,14,1,
14,1,6,2,8,1,12,1,4,1,10,1,14,2,10,1,
8,3,2,1,8,1,16,2,114,41,0,0,0,41,40,114,
74,0,0,0,90,26,95,102,114,111,122,101,110,95,105,109,
112,111,114,116,108,105,98,95,101,120,116,101,114,110,97,108,
114,19,0,0,0,114,1,0,0,0,114,2,0,0,0,90,
17,95,102,114,111,122,101,110,95,105,109,112,111,114,116,108,
105,98,114,68,0,0,0,114,129,0,0,0,114,99,0,0,
0,114,130,0,0,0,114,59,0,0,0,114,113,0,0,0,
90,7,95,95,97,108,108,95,95,114,18,0,0,0,90,15,
112,97,116,104,95,115,101,112,97,114,97,116,111,114,115,114,
16,0,0,0,114,67,0,0,0,114,3,0,0,0,114,23,
0,0,0,218,4,116,121,112,101,114,62,0,0,0,114,4,
0,0,0,114,78,0,0,0,114,34,0,0,0,114,35,0,
0,0,114,33,0,0,0,114,25,0,0,0,114,106,0,0,
0,114,123,0,0,0,114,125,0,0,0,114,48,0,0,0,
114,128,0,0,0,114,135,0,0,0,218,8,95,95,99,111,
100,101,95,95,114,131,0,0,0,114,139,0,0,0,114,141,
0,0,0,114,149,0,0,0,114,155,0,0,0,114,41,0,
0,0,114,9,0,0,0,114,9,0,0,0,114,9,0,0,
0,114,10,0,0,0,218,8,60,109,111,100,117,108,101,62,
13,0,0,0,115,78,0,0,0,4,4,8,1,16,1,8,
1,8,1,8,1,8,1,8,1,8,2,8,3,6,1,14,
3,16,4,4,2,8,3,14,127,0,120,12,1,12,1,2,
1,2,253,2,255,2,9,8,4,8,9,8,31,8,103,2,
254,2,29,4,5,8,21,8,46,8,8,8,28,10,5,8,
7,8,6,8,13,8,16,
};
......@@ -191,7 +191,6 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
PyObject *importlib;
PyObject *impmod;
PyObject *value;
_PyInitError err;
/* Import _importlib through its frozen version, _frozen_importlib. */
if (PyImport_ImportFrozenModule("_frozen_importlib") <= 0) {
......@@ -233,11 +232,6 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
Py_DECREF(value);
Py_DECREF(impmod);
err = _PyImportZip_Init();
if (_Py_INIT_FAILED(err)) {
return err;
}
return _Py_INIT_OK();
}
......@@ -252,7 +246,7 @@ initexternalimport(PyInterpreterState *interp)
return _Py_INIT_ERR("external importer setup failed");
}
Py_DECREF(value);
return _Py_INIT_OK();
return _PyImportZip_Init();
}
/* Helper functions to better handle the legacy C locale
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment