Change exec_module to load_module#2249
Conversation
|
Thanks for the quick update! Is it possible to include tests for this code? And do you have an idea why we only hit this on Python 3.9 and not 3.5-3.8? |
|
@hugovk Unfortunately, I don't know the answer to either of those questions. |
|
This issue hit me today on both 3.7.5 and 3.7.7. |
By strange coincidence, I just happened to be looking at this same import types
from importlib.machinery import ExtensionFileLoader
loader = ExtensionFileLoader(__name__, __file__)
module = types.ModuleType(loader.name)
loader.exec_module(module) |
|
Can you please push a patch to PYPI? Many projects that don't pin the version are starting to get the bug. |
I originally wrote this code using
load_moduleand then changed it toexec_modulebecause the documentation says thatload_moduleis deprecated, but I didn't notice thatexec_modulerequires an argument. Since it's not clear from the documentation howexec_moduleis supposed to be used, andload_moduledoesn't actually emit a DeprecationWarning (fixing the warning was the original motivation for changing this code), I think we should just useload_modulefor now.