File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -464,13 +464,16 @@ def LoadLibrary(self, name):
464464cdll = LibraryLoader (CDLL )
465465pydll = LibraryLoader (PyDLL )
466466
467- if _os .name == "nt" :
468- pythonapi = PyDLL ("python dll" , None , _sys .dllhandle )
469- elif _sys .platform == "cygwin" :
470- pythonapi = PyDLL ("libpython%d.%d.dll" % _sys .version_info [:2 ])
471- else :
472- pythonapi = PyDLL (None )
473-
467+ # dlopen is not supported in statically linked programs.
468+ try :
469+ if _os .name == "nt" :
470+ pythonapi = PyDLL ("python dll" , None , _sys .dllhandle )
471+ elif _sys .platform == "cygwin" :
472+ pythonapi = PyDLL ("libpython%d.%d.dll" % _sys .version_info [:2 ])
473+ else :
474+ pythonapi = PyDLL (None )
475+ except OSError :
476+ pythonapi = None
474477
475478if _os .name == "nt" :
476479 windll = LibraryLoader (WinDLL )
You can’t perform that action at this time.
0 commit comments