Skip to content

Commit 8d576ad

Browse files
authored
Support Julia 1.8 (#460)
* Reenable nightly * Don't fail when jl_typeof is missing * Skip sysimage tests on Julia nightly
1 parent bee73ec commit 8d576ad

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- '1.0'
2626
- '1.6'
2727
- '~1.7.0-rc1'
28-
# - 'nightly' # TODO: reenable
28+
- 'nightly'
2929
exclude:
3030
- os: ubuntu-latest
3131
architecture: x86

src/julia/core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@ def _is_unboxable_as(self, pointer, c_type):
564564
actual = self.api.jl_typeof(pointer)
565565
return actual == desired
566566

567+
# `_unbox_as` was added for communicating with Julia runtime before
568+
# initializing PyCal:
569+
# * Fail with a helpful message if separate cache is not supported
570+
# https://github.com/JuliaPy/pyjulia/pull/186
571+
# However, this is not used anymore at the moment. Maybe clean this up?
567572
def _unbox_as(self, pointer, c_type):
568573
self._check_unboxable(c_type)
569574
jl_unbox = getattr(self.api, 'jl_unbox_{}'.format(c_type))

src/julia/libjulia.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,14 @@ def setup_libjulia(libjulia):
6464
),
6565
)
6666

67-
libjulia.jl_typeof.argtypes = [c_void_p]
68-
libjulia.jl_typeof.restype = c_void_p
67+
# This does not exist in Julia 1.8 anymore:
68+
try:
69+
jl_typeof = libjulia.jl_typeof
70+
except AttributeError:
71+
pass
72+
else:
73+
jl_typeof.argtypes = [c_void_p]
74+
jl_typeof.restype = c_void_p
6975

7076
libjulia.jl_exception_clear.restype = None
7177
libjulia.jl_stderr_obj.argtypes = []

src/julia/tests/test_sysimage.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ def skip_early_julia_versions(juliainfo):
1616
pytest.skip("Julia < 1.3.1 is not supported")
1717

1818

19+
def skip_julia_nightly(juliainfo):
20+
if juliainfo.version_info >= (1, 8):
21+
pytest.skip("custom sysimage with Julia >= 1.8 (nightly) is not supported")
22+
23+
1924
def assert_sample_julia_code_runs(juliainfo, sysimage_path):
2025
very_random_string = "4903dc03-950f-4a54-98a3-c57a354b62df"
2126
proc = runcode(
@@ -48,6 +53,7 @@ def assert_sample_julia_code_runs(juliainfo, sysimage_path):
4853
@pytest.mark.parametrize("with_pycall_cache", [False, True])
4954
def test_build_and_load(tmpdir, juliainfo, with_pycall_cache):
5055
skip_early_julia_versions(juliainfo)
56+
skip_julia_nightly(juliainfo)
5157

5258
if with_pycall_cache:
5359
build_pycall(julia=juliainfo.julia)
@@ -75,6 +81,7 @@ def test_build_and_load(tmpdir, juliainfo, with_pycall_cache):
7581
@skip_in_apple
7682
def test_build_with_basesysimage_and_load(tmpdir, juliainfo):
7783
skip_early_julia_versions(juliainfo)
84+
skip_julia_nightly(juliainfo)
7885

7986
sysimage_path = str(tmpdir.join("sys.so"))
8087
base_sysimage_path = juliainfo.sysimage

0 commit comments

Comments
 (0)