mirror of
https://github.com/python/cpython.git
synced 2025-11-07 17:12:03 +00:00
gh-138310: Adds sys.audit event for import_module (#138311)
* Updates sys.audit calls for imports to include import_module * Adds unit tests for existing and new functionality
This commit is contained in:
parent
7257b24140
commit
2fd43a1ffe
8 changed files with 98 additions and 27 deletions
|
|
@ -1307,6 +1307,14 @@ def _sanity_check(name, package, level):
|
|||
|
||||
def _find_and_load_unlocked(name, import_):
|
||||
path = None
|
||||
sys.audit(
|
||||
"import",
|
||||
name,
|
||||
path,
|
||||
getattr(sys, "path", None),
|
||||
getattr(sys, "meta_path", None),
|
||||
getattr(sys, "path_hooks", None)
|
||||
)
|
||||
parent = name.rpartition('.')[0]
|
||||
parent_spec = None
|
||||
if parent:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue