8000 Merge pull request #1440 from losttech/PR/No_find_libpyton_for_import… · chubbyerror/pythonnet@0775458 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0775458

Browse files
authored
Merge pull request pythonnet#1440 from losttech/PR/No_find_libpyton_for_import_clr
Do not call `find_libpython` during `import clr` as Python.Runtime can find it on its own
2 parents 23527d1 + dff75d2 commit 0775458

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

pythonnet/__init__.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def load():
2929
if _LOADED:
3030
return
3131

32-
from .find_libpython import linked_libpython
3332
from os.path import join, dirname
3433

3534
if _RUNTIME is None:
@@ -38,21 +37,11 @@ def load():
3837
set_default_runtime()
3938

4039
dll_path = join(dirname(__file__), "runtime", "Python.Runtime.dll")
41-
libpython = linked_libpython()
42-
43-
if libpython and _FFI is None and sys.platform != "win32":
44-
# Load and leak libpython handle s.t. the .NET runtime doesn't dlcloses
45-
# it
46-
import posix
47-
48-
import cffi
49-
_FFI = cffi.FFI()
50-
_FFI.dlopen(libpython, posix.RTLD_NODELETE | posix.RTLD_LOCAL)
51-
40+
5241
_LOADER_ASSEMBLY = _RUNTIME.get_assembly(dll_path)
5342

5443
func = _LOADER_ASSEMBLY["Python.Runtime.Loader.Initialize"]
55-
if func(f"{libpython or ''}".encode("utf8")) != 0:
44+
if func(''.encode("utf8")) != 0:
5645
raise RuntimeError("Failed to initialize Python.Runtime.dll")
5746

5847
import atexit

0 commit comments

Comments
 (0)
0