bpo-26131: deprecate the use of load_module() by brettcannon · Pull Request #22905 · python/cpython (original) (raw)

Deprecating the use of load_module() requires two parts:

  1. The actual load_module() implementations are deprecated.
  2. Use of load_module() as a fallback for exec_module() trigger an ImportWarning.

This makes sure that either direct use of the method or indirect use by the import system raises some warning.

The method itself has been documented as deprecated since Python 3.6 and has been superceded by exec_module().

https://bugs.python.org/issue26131