From 1adb12321ae4819575705f7d4382f48a4f85e96a Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Fri, 26 Jun 2026 11:48:47 +0200 Subject: [PATCH 1/2] Disable tagged test_select_read_write on darwin/aarch64 --- .../src/tests/unittest_tags/test_selectors.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_selectors.txt b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_selectors.txt index 269b15eeb5..9ba7b4e42d 100644 --- a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_selectors.txt +++ b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_selectors.txt @@ -8,7 +8,9 @@ test.test_selectors.DefaultSelectorTestCase.test_modify @ darwin-arm64,linux-aar test.test_selectors.DefaultSelectorTestCase.test_register @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_selectors.DefaultSelectorTestCase.test_select @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_selectors.DefaultSelectorTestCase.test_select_interrupt_noraise @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github -test.test_selectors.DefaultSelectorTestCase.test_select_read_write @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github +test.test_selectors.DefaultSelectorTestCase.test_select_read_write @ linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github +# Darwin arm64 kqueue intermittently misses the read event +!test.test_selectors.DefaultSelectorTestCase.test_select_read_write @ darwin-arm64 test.test_selectors.DefaultSelectorTestCase.test_selector @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_selectors.DefaultSelectorTestCase.test_timeout @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_selectors.DefaultSelectorTestCase.test_unregister @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github From 796c454bfe3fc64fb60b247c598c7aa745551cb8 Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Fri, 26 Jun 2026 12:17:20 +0200 Subject: [PATCH 2/2] Add patches for newer numba/tables/llvmlite/fastparquet versions --- .../patches/fastparquet-2026.5.0.patch | 13 +++ .../patches/llvmlite-0.47.patch | 33 ++++++++ .../lib-graalpython/patches/metadata.toml | 27 +++++- .../patches/numba-0.65.1.patch | 83 +++++++++++++++++++ .../patches/tables-3.11.1.patch | 15 ++++ 5 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 graalpython/lib-graalpython/patches/fastparquet-2026.5.0.patch create mode 100644 graalpython/lib-graalpython/patches/llvmlite-0.47.patch create mode 100644 graalpython/lib-graalpython/patches/numba-0.65.1.patch create mode 100644 graalpython/lib-graalpython/patches/tables-3.11.1.patch diff --git a/graalpython/lib-graalpython/patches/fastparquet-2026.5.0.patch b/graalpython/lib-graalpython/patches/fastparquet-2026.5.0.patch new file mode 100644 index 0000000000..07637df2ae --- /dev/null +++ b/graalpython/lib-graalpython/patches/fastparquet-2026.5.0.patch @@ -0,0 +1,13 @@ +diff --git a/setup.py b/setup.py +index 11c1228..b51b646 100644 +--- a/setup.py ++++ b/setup.py +@@ -40,7 +40,7 @@ else: + + import platform + _machine = platform.machine() +- _march = ['-march=x86-64-v2'] if _machine == 'x86_64' else [] ++ _march = ['-march=x86-64-v2'] if _machine == 'x86_64' and sys.implementation.name != 'graalpy' else [] + modules = [ + Extension(mod, fix_exts(sources), extra_compile_args=['-O3'] + _march) + for mod, sources in modules_to_build.items()] diff --git a/graalpython/lib-graalpython/patches/llvmlite-0.47.patch b/graalpython/lib-graalpython/patches/llvmlite-0.47.patch new file mode 100644 index 0000000000..422333addd --- /dev/null +++ b/graalpython/lib-graalpython/patches/llvmlite-0.47.patch @@ -0,0 +1,33 @@ +diff --git a/ffi/build.py b/ffi/build.py +index ef0c262..6dc70b8 100755 +--- a/ffi/build.py ++++ b/ffi/build.py +@@ -205,5 +205,28 @@ def main(): + raise RuntimeError("unsupported platform: %r" % (sys.platform,)) + + ++def build_llvm(): ++ import urllib.request ++ import tarfile ++ import shutil ++ llvm_version = '20.1.8' ++ llvm_tag = f'llvmorg-{llvm_version}' ++ llvmdir = f'llvm-project-{llvm_tag}' ++ tarname = f'{llvm_tag}.tar.gz' ++ shutil.rmtree(tarname, ignore_errors=True) ++ shutil.rmtree(llvmdir, ignore_errors=True) ++ print(f"Downloading LLVM {llvm_version}") ++ urllib.request.urlretrieve(f'https://github.com/llvm/llvm-project/archive/refs/tags/{llvm_tag}.tar.gz', tarname) ++ with tarfile.open(tarname) as tar: ++ tar.extractall() ++ print(f"Building LLVM {llvm_version}") ++ subprocess.check_call(['cmake', '-S', f'{llvmdir}/llvm', '-B', 'llvm-build', '-DCMAKE_BUILD_TYPE=Release', '-DLLVM_TARGETS_TO_BUILD=host']) ++ subprocess.check_call(['cmake', '--build', 'llvm-build']) ++ os.environ['LLVM_CONFIG'] = os.path.abspath('llvm-build/bin/llvm-config') ++ ++ + if __name__ == "__main__": ++ # GraalPy change: fetch and build a supported LLVM rather than relying on ++ # whatever LLVM is available in the system image. ++ build_llvm() + main() diff --git a/graalpython/lib-graalpython/patches/metadata.toml b/graalpython/lib-graalpython/patches/metadata.toml index 75dd5dcf0f..b009f39440 100644 --- a/graalpython/lib-graalpython/patches/metadata.toml +++ b/graalpython/lib-graalpython/patches/metadata.toml @@ -152,6 +152,11 @@ patch = 'flake8-6.0.0.patch' license = 'MIT' subdir = 'src' +[[fastparquet.rules]] +version = '== 2026.5.0' +patch = 'fastparquet-2026.5.0.patch' +license = 'Apache-2.0' + [[greenlet.rules]] version = '>= 3.1.1' patch = 'greenlet-3.1.1.patch' @@ -298,8 +303,14 @@ patch = 'lightfm-1.15.patch' license = 'MIT' [[llvmlite.rules]] -# llvmlite only supports up to LLVM 14. That's quite old and installing it in the system typically results leads -# to dependency hell because rust requires newer LLVM. We add downloading and building LLVM 14 to the setup script. +version = '>= 0.45' +patch = 'llvmlite-0.47.patch' +license = 'BSD-2-Clause' + +[[llvmlite.rules]] +# Older llvmlite versions support up to LLVM 14. Installing it in the system typically leads to dependency hell +# because rust requires newer LLVM. We add downloading and building LLVM 14 to the setup script. +version = '< 0.45' patch = 'llvmlite.patch' license = 'BSD-2-Clause' @@ -382,6 +393,13 @@ license = 'Apache-2.0' patch = 'nanobind.patch' license = 'BSD-3-Clause' +[[numba.rules]] +# Not upstreamable, we disable the JIT +note = "Numba JIT relies on bytecode parsing and is disabled on GraalPy." +version = '== 0.65.1' +patch = 'numba-0.65.1.patch' +license = 'BSD-2-Clause' + [[numba.rules]] # Not upstreamable, we disable the JIT note = "Numba JIT relies on bytecode parsing and is disabled on GraalPy." @@ -915,6 +933,11 @@ version = '>= 70.1.0' patch = 'setuptools.patch' license = 'MIT' +[[tables.rules]] +version = '== 3.11.1' +patch = 'tables-3.11.1.patch' +license = 'BSD-3-Clause' + [[tensorflow.rules]] version = '== 2.15.0' patch = 'tensorflow-2.15.0.patch' diff --git a/graalpython/lib-graalpython/patches/numba-0.65.1.patch b/graalpython/lib-graalpython/patches/numba-0.65.1.patch new file mode 100644 index 0000000000..80e44a92db --- /dev/null +++ b/graalpython/lib-graalpython/patches/numba-0.65.1.patch @@ -0,0 +1,83 @@ +diff --git a/numba/_dispatcher.cpp b/numba/_dispatcher.cpp +index 0aa4aad..db6243b 100644 +--- a/numba/_dispatcher.cpp ++++ b/numba/_dispatcher.cpp +@@ -27,7 +27,11 @@ + * + */ + +-#if (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14)) ++#if defined(NUMBA_GRAALPY) && (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14)) ++ ++#define C_TRACE(x, call, frame) x = call ++ ++#elif (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14)) + + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 +@@ -791,6 +795,23 @@ call_cfunc(Dispatcher *self, PyObject *cfunc, PyObject *args, PyObject *kws, PyO + } + } + ++#elif defined(NUMBA_GRAALPY) && (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14)) ++ ++/* GraalPy change: GraalPy does not expose CPython's private sys.monitoring ++ * structures. Since Numba JIT decorators are disabled on GraalPy, use a simple ++ * direct call path here. ++ */ ++static PyObject * ++call_cfunc(Dispatcher *self, PyObject *cfunc, PyObject *args, PyObject *kws, PyObject *locals) ++{ ++ PyCFunctionWithKeywords fn = NULL; ++ ++ assert(PyCFunction_Check(cfunc)); ++ assert(PyCFunction_GET_FLAGS(cfunc) == (METH_VARARGS | METH_KEYWORDS)); ++ fn = (PyCFunctionWithKeywords) PyCFunction_GET_FUNCTION(cfunc); ++ return fn(PyCFunction_GET_SELF(cfunc), args, kws); ++} ++ + #elif (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14)) + + // Python 3.12 has a completely new approach to tracing and profiling due to +diff --git a/numba/core/decorators.py b/numba/core/decorators.py +index d70af73..8a46999 100644 +--- a/numba/core/decorators.py ++++ b/numba/core/decorators.py +@@ -215,6 +215,10 @@ def _jit(sigs, locals, target, cache, targetoptions, **dispatcher_args): + f"{type(func)})." + ) + ++ if sys.implementation.name == 'graalpy': ++ if target == 'npyufunc': ++ raise NotImplementedError("Cannot create npyufunc under graalpy") ++ return func + if config.ENABLE_CUDASIM and target == 'cuda': + from numba import cuda + return cuda.jit(func) +diff --git a/pyproject.toml b/pyproject.toml +new file mode 100644 +index 0000000..562214d +--- /dev/null ++++ b/pyproject.toml +@@ -0,0 +1,8 @@ ++[build-system] ++requires = ["setuptools >= 40.6.0", "wheel", "llvmlite<0.48,>=0.47.0dev0", "numpy<2.5,>=2.0.0rc1", "versioneer"] ++build-backend = "setuptools.build_meta" ++ ++[tool.versioneer] ++VCS = 'git' ++versionfile_source = 'numba/_version.py' ++versionfile_build ='numba/_version.py' +diff --git a/setup.py b/setup.py +index 282b8f4..33ea09e 100644 +--- a/setup.py ++++ b/setup.py +@@ -167,6 +167,8 @@ def get_ext_modules(): + "numba/_hashtable.h"], + extra_compile_args=['-std=c++11'], + **np_compile_args) ++ if sys.implementation.name == 'graalpy': ++ ext_dispatcher.define_macros.append(('NUMBA_GRAALPY', '1')) + + ext_helperlib = Extension(name="numba._helperlib", + sources=["numba/_helpermod.c", diff --git a/graalpython/lib-graalpython/patches/tables-3.11.1.patch b/graalpython/lib-graalpython/patches/tables-3.11.1.patch new file mode 100644 index 0000000000..eb47b88d7b --- /dev/null +++ b/graalpython/lib-graalpython/patches/tables-3.11.1.patch @@ -0,0 +1,15 @@ +diff --git a/hdf5-blosc2/src/blosc2_filter.c b/hdf5-blosc2/src/blosc2_filter.c +index 03bf789..d3903d4 100644 +--- a/hdf5-blosc2/src/blosc2_filter.c ++++ b/hdf5-blosc2/src/blosc2_filter.c +@@ -17,6 +17,10 @@ + #include "blosc2_filter.h" + #include "b2nd.h" + ++#ifndef BLOSC2_MAX_DIM ++#define BLOSC2_MAX_DIM B2ND_MAX_DIM ++#endif ++ + #if defined(__GNUC__) + #define PUSH_ERR(func, minor, str, ...) H5Epush(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLINE, minor, str, ##__VA_ARGS__) + #elif defined(_MSC_VER)