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

Commit58bd58c

Browse files
committed
Ensure that shutdown is called from Python
1 parente9cbb87 commit58bd58c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎pythonnet/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def set_runtime(runtime):
1616

1717

1818
defset_default_runtime()->None:
19-
ifsys.platform=='win32':
19+
ifsys.platform=="win32":
2020
set_runtime(clr_loader.get_netfx())
2121
else:
2222
set_runtime(clr_loader.get_mono())
@@ -36,22 +36,23 @@ def load():
3636
set_default_runtime()
3737

3838
dll_path=join(dirname(__file__),"runtime","Python.Runtime.dll")
39-
39+
4040
_LOADER_ASSEMBLY=_RUNTIME.get_assembly(dll_path)
4141

4242
func=_LOADER_ASSEMBLY["Python.Runtime.Loader.Initialize"]
43-
iffunc(''.encode("utf8"))!=0:
43+
iffunc(b"")!=0:
4444
raiseRuntimeError("Failed to initialize Python.Runtime.dll")
4545

4646
importatexit
47+
4748
atexit.register(unload)
4849

4950

5051
defunload():
5152
global_RUNTIME
5253
if_LOADER_ASSEMBLYisnotNone:
5354
func=_LOADER_ASSEMBLY["Python.Runtime.Loader.Shutdown"]
54-
iffunc(b"")!=0:
55+
iffunc(b"full_shutdown")!=0:
5556
raiseRuntimeError("Failed to call Python.NET shutdown")
5657

5758
if_RUNTIMEisnotNone:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp