Message386155
If I attempt to import an extension module via something like this:
from pkg import extmodule
and it happens that "pkg" is found in a folder that is given in sys.path as a relative path, then the import fails, with
ImportError: DLL load failed while importing extmodule: The parameter is incorrect.
This only happens with 3.8 and later.
AFAICS the reason is that if the module resolution is done via a relative path, it results in dynload_win.c:_PyImport_FindSharedFuncptrWindows attempting to feed LoadLibraryExW a relative path for the .pyd file. But LoadLibraryExW treats relative paths completely differently from absolute ones, in that it searches for the given path relative to the library search path entries rather than simply loading the DLL at that path. But as of 3.8 the current directory is removed from the search path, so the .pyd is never found. Since Python knows the specific file it wants LoadLibraryExW to load, having just resolved it via the import mechanism, I guess it ought to ensure it only ever calls LoadLibraryExW with an absolute path.
(I'm assuming use of relative paths in sys.path is officially supported, since nothing I've found in the docs says otherwise.) |
|
Date |
User |
Action |
Args |
2021-02-02 17:03:00 | smunday | set | recipients:
+ smunday |
2021-02-02 17:03:00 | smunday | set | messageid: <1612285380.24.0.495785451269.issue43105@roundup.psfhosted.org> |
2021-02-02 17:03:00 | smunday | link | issue43105 messages |
2021-02-02 17:03:00 | smunday | create | |
|