Skip to content

Commit

Permalink
Support Julia 1.8 (#460)
Browse files Browse the repository at this point in the history
* Reenable nightly

* Don't fail when jl_typeof is missing

* Skip sysimage tests on Julia nightly
  • Loading branch information
tkf committed Oct 25, 2021
1 parent bee73ec commit 8d576ad
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- '1.0'
- '1.6'
- '~1.7.0-rc1'
# - 'nightly' # TODO: reenable
- 'nightly'
exclude:
- os: ubuntu-latest
architecture: x86
Expand Down
5 changes: 5 additions & 0 deletions src/julia/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ def _is_unboxable_as(self, pointer, c_type):
actual = self.api.jl_typeof(pointer)
return actual == desired

# `_unbox_as` was added for communicating with Julia runtime before
# initializing PyCal:
# * Fail with a helpful message if separate cache is not supported
# https://github.com/JuliaPy/pyjulia/pull/186
# However, this is not used anymore at the moment. Maybe clean this up?
def _unbox_as(self, pointer, c_type):
self._check_unboxable(c_type)
jl_unbox = getattr(self.api, 'jl_unbox_{}'.format(c_type))
Expand Down
10 changes: 8 additions & 2 deletions src/julia/libjulia.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ def setup_libjulia(libjulia):
),
)

libjulia.jl_typeof.argtypes = [c_void_p]
libjulia.jl_typeof.restype = c_void_p
# This does not exist in Julia 1.8 anymore:
try:
jl_typeof = libjulia.jl_typeof
except AttributeError:
pass
else:
jl_typeof.argtypes = [c_void_p]
jl_typeof.restype = c_void_p

libjulia.jl_exception_clear.restype = None
libjulia.jl_stderr_obj.argtypes = []
Expand Down
7 changes: 7 additions & 0 deletions src/julia/tests/test_sysimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def skip_early_julia_versions(juliainfo):
pytest.skip("Julia < 1.3.1 is not supported")


def skip_julia_nightly(juliainfo):
if juliainfo.version_info >= (1, 8):
pytest.skip("custom sysimage with Julia >= 1.8 (nightly) is not supported")


def assert_sample_julia_code_runs(juliainfo, sysimage_path):
very_random_string = "4903dc03-950f-4a54-98a3-c57a354b62df"
proc = runcode(
Expand Down Expand Up @@ -48,6 +53,7 @@ def assert_sample_julia_code_runs(juliainfo, sysimage_path):
@pytest.mark.parametrize("with_pycall_cache", [False, True])
def test_build_and_load(tmpdir, juliainfo, with_pycall_cache):
skip_early_julia_versions(juliainfo)
skip_julia_nightly(juliainfo)

if with_pycall_cache:
build_pycall(julia=juliainfo.julia)
Expand Down Expand Up @@ -75,6 +81,7 @@ def test_build_and_load(tmpdir, juliainfo, with_pycall_cache):
@skip_in_apple
def test_build_with_basesysimage_and_load(tmpdir, juliainfo):
skip_early_julia_versions(juliainfo)
skip_julia_nightly(juliainfo)

sysimage_path = str(tmpdir.join("sys.so"))
base_sysimage_path = juliainfo.sysimage
Expand Down

0 comments on commit 8d576ad

Please sign in to comment.