Skip to content

Commit 662da02

Browse files
author
Christopher Doris
committed
document new feature
1 parent 0614809 commit 662da02

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/src/releasenotes.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* `Serialization.serialize` can use `dill` instead of `pickle` by setting the env var `JULIA_PYTHONCALL_PICKLE=dill`.
55
* `numpy.bool_` can now be converted to `Bool` and other number types.
66
* `datetime.timedelta` can now be converted to `Dates.Nanosecond`, `Microsecond`, `Millisecond` and `Second`. This behaviour was already documented.
7+
* In JuliaCall, the Julia runtime is now properly terminated when Python exits. This means all finalizers should always run.
78

89
## 0.9.20 (2024-05-01)
910
* The IPython extension is now automatically loaded upon import if IPython is detected.

pysrc/juliacall/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
__version__ = '0.9.20'
55

6-
import atexit
7-
86
_newmodule = None
97

108
def newmodule(name):
@@ -51,6 +49,7 @@ def backtrace(self):
5149
CONFIG = {'inited': False}
5250

5351
def init():
52+
import atexit
5453
import os
5554
import ctypes as c
5655
import sys
@@ -201,6 +200,8 @@ def args_from_config():
201200
None if sysimg is None else sysimg.encode('utf8'),
202201
)
203202

203+
# call jl_atexit_hook() when python exits to gracefully stop the julia runtime,
204+
# including running finalizers for any objects that still exist
204205
@atexit.register
205206
def at_jl_exit():
206207
jl_atexit_hook = lib.jl_atexit_hook

0 commit comments

Comments
 (0)