This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Thrameos
Recipients Thrameos, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-12-01.18:03:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606845783.12.0.45647033223.issue42529@roundup.psfhosted.org>
In-reply-to
Content
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.
 

 ```
 import: 'jpype'
 Traceback (most recent call last):
    File "D:\bld\jpype1_1605785280189\test_tmp\run_test.py", line 2, in <module>
      import jpype
    File "D:\bld\jpype1_1605785280189\_test_env\lib\site-packages\jpype\__init__.py", line 18, in <module>
      import _jpype
 ImportError: DLL load failed while importing _jpype: A dynamic link library (DLL) initialization routine failed.
 ```
History
Date User Action Args
2020-12-01 18:03:03Thrameossetrecipients: + Thrameos, paul.moore, tim.golden, zach.ware, steve.dower
2020-12-01 18:03:03Thrameossetmessageid: <1606845783.12.0.45647033223.issue42529@roundup.psfhosted.org>
2020-12-01 18:03:03Thrameoslinkissue42529 messages
2020-12-01 18:03:02Thrameoscreate