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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,6 @@
import functools import functools
import glob import glob
import hashlib import hashlib
import importlib
import io import io
import os import os
import re import re
@ -818,12 +817,12 @@ def package_dir(cls):
@classproperty @classproperty
def module(cls): 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 We use this to add variables to package modules. This makes
install() methods easier to write (e.g., can call configure()) install() methods easier to write (e.g., can call configure())
""" """
return importlib.import_module(cls.__module__) return sys.modules[cls.__module__]
@classproperty @classproperty
def namespace(cls): def namespace(cls):