diff --git a/pythonnet/__init__.py b/pythonnet/__init__.py index 692fd5700..188980b8b 100644 --- a/pythonnet/__init__.py +++ b/pythonnet/__init__.py @@ -29,7 +29,6 @@ def load(): if _LOADED: return - from .find_libpython import linked_libpython from os.path import join, dirname if _RUNTIME is None: @@ -38,21 +37,11 @@ def load(): set_default_runtime() dll_path = join(dirname(__file__), "runtime", "Python.Runtime.dll") - libpython = linked_libpython() - - if libpython and _FFI is None and sys.platform != "win32": - # Load and leak libpython handle s.t. the .NET runtime doesn't dlcloses - # it - import posix - - import cffi - _FFI = cffi.FFI() - _FFI.dlopen(libpython, posix.RTLD_NODELETE | posix.RTLD_LOCAL) - + _LOADER_ASSEMBLY = _RUNTIME.get_assembly(dll_path) func = _LOADER_ASSEMBLY["Python.Runtime.Loader.Initialize"] - if func(f"{libpython or ''}".encode("utf8")) != 0: + if func(''.encode("utf8")) != 0: raise RuntimeError("Failed to initialize Python.Runtime.dll") import atexit