package_base.py: use sys.modules for module lookup (#50230)

This commit is contained in:
Harmen Stoppels
2025-04-29 12:53:30 +02:00
committed by GitHub
parent ecc3752ee9
commit a6b0dfbd53

View File

@@ -14,7 +14,6 @@
import functools
import glob
import hashlib
import importlib
import io
import os
import re
@@ -818,12 +817,12 @@ def package_dir(cls):
@classproperty
def module(cls):
"""Module object (not just the name) that this package is defined in.
"""Module instance that this package class is defined in.
We use this to add variables to package modules. This makes
install() methods easier to write (e.g., can call configure())
"""
return importlib.import_module(cls.__module__)
return sys.modules[cls.__module__]
@classproperty
def namespace(cls):