Skip to content

Remove deprecated importlib.load_module #133882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
picnixz opened this issue May 11, 2025 · 3 comments
Open

Remove deprecated importlib.load_module #133882

picnixz opened this issue May 11, 2025 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir topic-importlib type-feature A feature request or enhancement

Comments

@picnixz
Copy link
Member

picnixz commented May 11, 2025

Feature or enhancement

Originally deprecated in #23469, later delayed to 3.15 in aa81a6f.

@picnixz picnixz added type-feature A feature request or enhancement stdlib Python modules in the Lib dir topic-importlib labels May 11, 2025
@picnixz picnixz self-assigned this May 11, 2025
@picnixz

This comment has been minimized.

@picnixz picnixz closed this as completed May 11, 2025
@picnixz
Copy link
Member Author

picnixz commented May 11, 2025

Ok, you know what? because I want to discuss how the removal plan is to be done, I'm re-opening this one.

@picnixz picnixz reopened this May 11, 2025
@picnixz
Copy link
Member Author

picnixz commented May 11, 2025

@brettcannon I started working on this one, but I encountered the following issues:

  • If we remove load_module, can we just assume that exec_module exists and implements the expected protocol? (namely, what to do in term of ABCs & co?)
  • There are a lot of tests that only rely on load_module but do not rely on exec_module. There are tests for exec_module though but it's mainly tested via load_module() calls.
  • Should we keep testing load_module() implementations based on exec_module, or should we change the test suite so that we only use exec_module? or should we just keep the load_module() implementation but for tests only.

It's kind of hard to know what happens in both tests and importlib at the same time as there are many mixins and dynamically-set attributes. I tried to replace the load_module() with an exec_module() equivalent but it's not easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-importlib type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant