Skip to content

useless code in zipimport can be dropped #140324

Closed as duplicate
Closed as duplicate

Description

@yihong0618

the function load_module drop in patch https://github.com/python/cpython/pull/133662/files

but forgot to drop the _module_type

diff --git a/Lib/zipimport.py b/Lib/zipimport.py
index 188c4bca97..7311daf2b8 100644
--- a/Lib/zipimport.py
+++ b/Lib/zipimport.py
@@ -18,7 +18,6 @@
 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']
@@ -34,8 +33,6 @@ class ZipImportError(ImportError):
 # _read_directory() cache
 _zip_directory_cache = {}
 
-_module_type = type(sys)
-
 END_CENTRAL_DIR_SIZE = 22
 END_CENTRAL_DIR_SIZE_64 = 56
 END_CENTRAL_DIR_LOCATOR_SIZE_64 = 20

Linked PRs

Activity

  1. added
    stdlib
    type-refactor
    on Oct 19, 2025
  2. changed the title [-]useless code in zipimport can be dorp[/-] on Oct 19, 2025
  3. StanFromIreland commented on Oct 19, 2025

    @StanFromIreland
    Member

    Please don't create issues for such things in the future, #133656 could have been reused.

  4. yihong0618 commented on Oct 19, 2025

    @yihong0618
    ContributorAuthor

    Please don't create issues for such things in the future, #133656 could have been reused.

    copy that, will use this way next time

  5. picnixz commented on Oct 19, 2025

    @picnixz
    Member

    @StanFromIreland Can you close this issue as a duplicate and link the PR against the previous issue so that we know that this PR is linked with the other please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtype-refactor

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions