(self, fullname)
| 796 | # Get the code object associated with the module specified by |
| 797 | # 'fullname'. |
| 798 | def _get_module_code(self, fullname): |
| 799 | path = _get_module_path(self, fullname) |
| 800 | import_error = None |
| 801 | for suffix, isbytecode, ispackage in _zip_searchorder: |
| 802 | fullpath = path + suffix |
| 803 | _bootstrap._verbose_message('trying {}{}{}', self.archive, path_sep, fullpath, verbosity=2) |
| 804 | try: |
| 805 | toc_entry = self._get_files()[fullpath] |
| 806 | except KeyError: |
| 807 | pass |
| 808 | else: |
| 809 | modpath = toc_entry[0] |
| 810 | data = _get_data(self.archive, toc_entry) |
| 811 | code = None |
| 812 | if isbytecode: |
| 813 | try: |
| 814 | code = _unmarshal_code(self, modpath, fullpath, fullname, data) |
| 815 | except ImportError as exc: |
| 816 | import_error = exc |
| 817 | else: |
| 818 | code = _compile_source(modpath, data, fullname) |
| 819 | if code is None: |
| 820 | # bad magic number or non-matching mtime |
| 821 | # in byte code, try next |
| 822 | continue |
| 823 | modpath = toc_entry[0] |
| 824 | return code, ispackage, modpath |
| 825 | else: |
| 826 | if import_error: |
| 827 | msg = f"module load failed: {import_error}" |
| 828 | raise ZipImportError(msg, name=fullname) from import_error |
| 829 | else: |
| 830 | raise ZipImportError(f"can't find module {fullname!r}", name=fullname) |
no test coverage detected
searching dependent graphs…