Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0775458

Browse files
authored
Merge pull request#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 parents23527d1 +dff75d2 commit0775458

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_libpythonimportlinked_libpython
3332
fromos.pathimportjoin,dirname
3433

3534
if_RUNTIMEisNone:
@@ -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-
iflibpythonand_FFIisNoneandsys.platform!="win32":
44-
# Load and leak libpython handle s.t. the .NET runtime doesn't dlcloses
45-
# it
46-
importposix
47-
48-
importcffi
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-
iffunc(f"{libpythonor''}".encode("utf8"))!=0:
44+
iffunc(''.encode("utf8"))!=0:
5645
raiseRuntimeError("Failed to initialize Python.Runtime.dll")
5746

5847
importatexit

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp