[New-bugs-announce] [issue42529] CPython DLL initialization routine failed from PYC cache file
report at bugs.python.org
Tue Dec 1 13:03:03 EST 2020
New submission from Karl Nelson <nelson85 at llnl.gov>:
While trying to use JPype on Windows Python 3.9.0, we are running into an bizarre issue with loading the internal module which is written in C. When running a python script the first time the internal module loads correctly. However, the second time that script is run the internal module reports "A dynamic link library (DLL) initialization routine failed." If you then erase the pyc cache file that is importing the internal module then it works again. This only occurs on Windows and was not present using the same source prior versions of Python 3.8.
We investigate the byte codes from both version and they are doing the same series of actions so the problem appears to be calling the same opcode to execute an import.
I make sure all required symbols were found in the libraries and only only copy of the internal DLL was the same with and without loading from a pyc.
It may be a change in the requirements of module initialization, but I don't know how to proceed. There was one deprecation warning but correcting that did not alter the outcome.
It appears that the execute path for importing a CPython module takes a different path when the script was imported from something compiled on the fly as opposed to loading from a pyc.
Traceback (most recent call last):
File "D:\bld\jpype1_1605785280189\test_tmp\run_test.py", line 2, in <module>
File "D:\bld\jpype1_1605785280189\_test_env\lib\site-packages\jpype\__init__.py", line 18, in <module>
ImportError: DLL load failed while importing _jpype: A dynamic link library (DLL) initialization routine failed.
nosy: Thrameos, paul.moore, steve.dower, tim.golden, zach.ware
title: CPython DLL initialization routine failed from PYC cache file
versions: Python 3.9
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce