(self, fullname)
| 744 | # Get the code object associated with the module specified by |
| 745 | # 'fullname'. |
| 746 | def _get_module_code(self, fullname): |
| 747 | path = _get_module_path(self, fullname) |
| 748 | import_error = None |
| 749 | for suffix, isbytecode, ispackage in _zip_searchorder: |
| 750 | fullpath = path + suffix |
| 751 | _bootstrap._verbose_message('trying {}{}{}', self.archive, path_sep, fullpath, verbosity=2) |
| 752 | try: |
| 753 | toc_entry = self._files[fullpath] |
| 754 | except KeyError: |
| 755 | pass |
| 756 | else: |
| 757 | modpath = toc_entry[0] |
| 758 | data = _get_data(self.archive, toc_entry) |
| 759 | code = None |
| 760 | if isbytecode: |
| 761 | try: |
| 762 | code = _unmarshal_code(self, modpath, fullpath, fullname, data) |
| 763 | except ImportError as exc: |
| 764 | import_error = exc |
| 765 | else: |
| 766 | code = _compile_source(modpath, data) |
| 767 | if code is None: |
| 768 | # bad magic number or non-matching mtime |
| 769 | # in byte code, try next |
| 770 | continue |
| 771 | modpath = toc_entry[0] |
| 772 | return code, ispackage, modpath |
| 773 | else: |
| 774 | if import_error: |
| 775 | msg = f"module load failed: {import_error}" |
| 776 | raise ZipImportError(msg, name=fullname) from import_error |
| 777 | else: |
| 778 | raise ZipImportError(f"can't find module {fullname!r}", name=fullname) |
no test coverage detected