Skip to content

Commit ef9eabc

Browse files
committed
Merge branch 'github/patches/24.2.0' into github/patches/24.2.1
2 parents abd3912 + 634962b commit ef9eabc

File tree

8 files changed

+424
-9
lines changed

8 files changed

+424
-9
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "16d0e566573ebdcf380bf6f309c02724baf4172b" }
1+
{ "overlay": "ea6007b968048485d43905914816208f870ac88b" }
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
--- a/pyproject.toml
2+
+++ b/pyproject.toml
3+
@@ -2,13 +2,10 @@
4+
requires = [
5+
"setuptools>=43",
6+
"wheel",
7+
+ "Cython==3.0.10",
8+
]
9+
build-backend = "setuptools.build_meta"
10+
11+
[tool.cibuildwheel]
12+
-before-build = [
13+
- "pip install cython==3.0.10",
14+
- "cython {project}/jq.pyx",
15+
-]
16+
test-requires = "-r test-requirements.txt"
17+
test-command = "pytest {project}/tests"
18+
diff --git a/setup.py b/setup.py
19+
index 0b97097..54ed7b3 100644
20+
--- a/setup.py
21+
+++ b/setup.py
22+
@@ -94,15 +94,27 @@ else:
23+
os.path.join(jq_lib_dir, "modules/oniguruma/src/.libs/libonig.a"),
24+
]
25+
26+
+
27+
+try:
28+
+ # Follow recommendation from https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules
29+
+ from Cython.Build import cythonize
30+
+except ImportError:
31+
+ cythonize = lambda o: o
32+
+ ext = ".c"
33+
+else:
34+
+ ext = ".pyx"
35+
+
36+
+
37+
jq_extension = Extension(
38+
"jq",
39+
- sources=["jq.c"],
40+
+ sources=[_path_in_dir(f"jq{ext}")],
41+
define_macros=[("MS_WIN64" , 1)] if os.name == "nt" and sys.maxsize > 2**32 else None, # https://github.com/cython/cython/issues/2670
42+
include_dirs=[os.path.join(jq_lib_dir, "src")],
43+
extra_link_args=["-lm"] + (["-Wl,-Bstatic", "-lpthread", "-lshlwapi", "-static-libgcc"] if os.name == 'nt' else []) + link_args_deps,
44+
extra_objects=extra_objects,
45+
)
46+
47+
+
48+
setup(
49+
name='jq',
50+
version='1.8.0',
51+
@@ -112,7 +124,7 @@ setup(
52+
url='https://github.com/mwilliamson/jq.py',
53+
python_requires='>=3.6',
54+
license='BSD 2-Clause',
55+
- ext_modules = [jq_extension],
56+
+ ext_modules = cythonize([jq_extension]),
57+
cmdclass={"build_ext": jq_build_ext},
58+
classifiers=[
59+
'Development Status :: 5 - Production/Stable',

graalpython/lib-graalpython/patches/metadata.toml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ version = '<=1.3.2'
200200
patch = 'joblib-1.3.2.patch'
201201
license = 'BSD-3-Clause'
202202

203+
[[jq.rules]]
204+
version = '==1.8.0'
205+
patch = 'jq-1.8.0.patch'
206+
license = 'BSD-2-Clause'
207+
208+
[[jq.add-sources]]
209+
version = '1.8.0'
210+
url = 'https://github.com/mwilliamson/jq.py/archive/refs/tags/1.8.0.tar.gz'
211+
203212
[[jupyter_server.rules]]
204213
patch = 'jupyter_server.patch'
205214
license = 'BSD-3-Clause'
@@ -358,6 +367,12 @@ patch = 'pandas-2.2.2.patch'
358367
license = 'BSD-3-Clause'
359368
dist-type = 'sdist'
360369

370+
[[pandas.rules]]
371+
version = '== 2.2.3'
372+
patch = 'pandas-2.2.3.patch'
373+
license = 'BSD-3-Clause'
374+
dist-type = 'sdist'
375+
361376
[[pandas.rules]]
362377
version = '== 2.0.3'
363378
patch = 'pandas-2.0.3.patch'
@@ -394,11 +409,23 @@ patch = 'protobuf-3.21.9.patch'
394409
license = 'BSD-3-Clause'
395410

396411
[[psycopg2.rules]]
397-
patch = "psycopg2.patch"
412+
version = '<= 2.9.9'
413+
patch = "psycopg2-2.9.9.patch"
414+
license = "LGPL-3.0-or-later WITH openssl-exception"
415+
416+
[[psycopg2.rules]]
417+
version = '>= 2.9.10'
418+
patch = "psycopg2-2.9.10.patch"
398419
license = "LGPL-3.0-or-later WITH openssl-exception"
399420

400421
[[psycopg2-binary.rules]]
401-
patch = "psycopg2-binary.patch"
422+
version = '<= 2.9.9'
423+
patch = "psycopg2-2.9.9.patch"
424+
license = "LGPL-3.0-or-later WITH openssl-exception"
425+
426+
[[psycopg2-binary.rules]]
427+
version = '>= 2.9.10'
428+
patch = "psycopg2-2.9.10.patch"
402429
license = "LGPL-3.0-or-later WITH openssl-exception"
403430

404431
[[py4j.rules]]
@@ -416,6 +443,11 @@ version = '== 12.0.0'
416443
patch = 'pyarrow-12.0.0.patch'
417444
license = 'Apache-2.0'
418445

446+
[[pyarrow.rules]]
447+
version = '== 19.0.0'
448+
patch = 'pyarrow-19.0.0.patch'
449+
license = 'Apache-2.0'
450+
419451
[[pybind11.rules]]
420452
# Upstreamed
421453
install-priority = 0
@@ -726,6 +758,10 @@ version = '== 3.*'
726758
# transformers tends to depend on a specific version of tokenizers. Pin it to avoid pulling unpatched tokenizers
727759
version = '== 4.33.3'
728760

761+
[[trio.rules]]
762+
patch = 'trio.patch'
763+
license = 'Apache-2.0 OR MIT'
764+
729765
[[typing_extensions.rules]]
730766
patch = 'typing_extensions.patch'
731767
license = 'PSF-2.0'
@@ -741,6 +777,7 @@ version = '>= 2, < 2.0.3'
741777
install-priority = 0
742778

743779
[[uvloop.rules]]
780+
version = '<= 0.19.0'
744781
patch = 'uvloop.patch'
745782
license = 'MIT'
746783

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/pandas/_libs/include/pandas/vendored/klib/khash_python.h b/pandas/_libs/include/pandas/vendored/klib/khash_python.h
2+
index 5a933b4..f579fc6 100644
3+
--- a/pandas/_libs/include/pandas/vendored/klib/khash_python.h
4+
+++ b/pandas/_libs/include/pandas/vendored/klib/khash_python.h
5+
@@ -173,13 +173,15 @@ static inline int floatobject_cmp(PyFloatObject *a, PyFloatObject *b) {
6+
// PyObject_RichCompareBool for complexobjects has a different behavior
7+
// needs to be replaced
8+
static inline int complexobject_cmp(PyComplexObject *a, PyComplexObject *b) {
9+
- return (Py_IS_NAN(a->cval.real) && Py_IS_NAN(b->cval.real) &&
10+
- Py_IS_NAN(a->cval.imag) && Py_IS_NAN(b->cval.imag)) ||
11+
- (Py_IS_NAN(a->cval.real) && Py_IS_NAN(b->cval.real) &&
12+
- a->cval.imag == b->cval.imag) ||
13+
- (a->cval.real == b->cval.real && Py_IS_NAN(a->cval.imag) &&
14+
- Py_IS_NAN(b->cval.imag)) ||
15+
- (a->cval.real == b->cval.real && a->cval.imag == b->cval.imag);
16+
+ Py_complex a_cval = PyComplex_AsCComplex((PyObject*)a);
17+
+ Py_complex b_cval = PyComplex_AsCComplex((PyObject*)b);
18+
+ return (Py_IS_NAN(a_cval.real) && Py_IS_NAN(b_cval.real) &&
19+
+ Py_IS_NAN(a_cval.imag) && Py_IS_NAN(b_cval.imag)) ||
20+
+ (Py_IS_NAN(a_cval.real) && Py_IS_NAN(b_cval.real) &&
21+
+ a_cval.imag == b_cval.imag) ||
22+
+ (a_cval.real == b_cval.real && Py_IS_NAN(a_cval.imag) &&
23+
+ Py_IS_NAN(b_cval.imag)) ||
24+
+ (a_cval.real == b_cval.real && a_cval.imag == b_cval.imag);
25+
}
26+
27+
static inline int pyobject_cmp(PyObject *a, PyObject *b);
28+
@@ -250,8 +252,9 @@ static inline Py_hash_t floatobject_hash(PyFloatObject *key) {
29+
30+
// replaces _Py_HashDouble with _Pandas_HashDouble
31+
static inline Py_hash_t complexobject_hash(PyComplexObject *key) {
32+
- Py_uhash_t realhash = (Py_uhash_t)_Pandas_HashDouble(key->cval.real);
33+
- Py_uhash_t imaghash = (Py_uhash_t)_Pandas_HashDouble(key->cval.imag);
34+
+ Py_complex cval = PyComplex_AsCComplex((PyObject*)key);
35+
+ Py_uhash_t realhash = (Py_uhash_t)_Pandas_HashDouble(cval.real);
36+
+ Py_uhash_t imaghash = (Py_uhash_t)_Pandas_HashDouble(cval.imag);
37+
if (realhash == (Py_uhash_t)-1 || imaghash == (Py_uhash_t)-1) {
38+
return -1;
39+
}
40+
diff --git a/pyproject.toml b/pyproject.toml
41+
index db9f055..c191232 100644
42+
--- a/pyproject.toml
43+
+++ b/pyproject.toml
44+
@@ -5,7 +5,7 @@ requires = [
45+
"meson-python==0.13.1",
46+
"meson==1.2.1",
47+
"wheel",
48+
- "Cython~=3.0.5", # Note: sync with setup.py, environment.yml and asv.conf.json
49+
+ "Cython==3.0.10", # Note: sync with setup.py, environment.yml and asv.conf.json
50+
# Force numpy higher than 2.0, so that built wheels are compatible
51+
# with both numpy 1 and 2
52+
"numpy>=2.0",
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
diff --git a/psycopg/utils.c b/psycopg/utils.c
2-
index 16be906..c78a24b 100644
2+
index 1dfb87d..28cc6c1 100644
33
--- a/psycopg/utils.c
44
+++ b/psycopg/utils.c
55
@@ -392,7 +392,9 @@ psyco_set_error(PyObject *exc, cursorObject *curs, const char *msg)
66
static int
77
psyco_is_main_interp(void)
88
{
9-
-#if PY_VERSION_HEX >= 0x03080000
9+
-#if PY_VERSION_HEX >= 0x030d0000
1010
+#if GRAALVM_PYTHON
1111
+ return 1;
12-
+#elif PY_VERSION_HEX >= 0x03080000
13-
/* tested with Python 3.8.0a2 */
14-
return _PyInterpreterState_Get() == PyInterpreterState_Main();
15-
#else
12+
+#elif PY_VERSION_HEX >= 0x030d0000
13+
/* tested with Python 3.13.0a6 */
14+
return PyInterpreterState_Get() == PyInterpreterState_Main();
15+
#elif PY_VERSION_HEX >= 0x03080000
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
diff --git a/pyarrow/error.pxi b/pyarrow/error.pxi
2+
index cbe2552..8d0d9d9 100644
3+
--- a/pyarrow/error.pxi
4+
+++ b/pyarrow/error.pxi
5+
@@ -248,7 +248,7 @@ cdef class SignalStopHandler:
6+
if exc_value.signum:
7+
# Re-emit the exact same signal. We restored the Python signal
8+
# handler above, so it should receive it.
9+
- if os.name == 'nt':
10+
+ if os.name == 'nt' or sys.implementation.name == 'graalpy':
11+
SendSignal(exc_value.signum)
12+
else:
13+
SendSignalToThread(exc_value.signum,
14+
diff --git a/pyarrow/memory.pxi b/pyarrow/memory.pxi
15+
index 1ddcb01..6805e42 100644
16+
--- a/pyarrow/memory.pxi
17+
+++ b/pyarrow/memory.pxi
18+
@@ -20,6 +20,10 @@
19+
# cython: embedsignature = True
20+
21+
22+
+cdef extern from "Python.h":
23+
+ void Py_INCREF(object)
24+
+
25+
+
26+
cdef class MemoryPool(_Weakrefable):
27+
"""
28+
Base class for memory allocation.
29+
@@ -35,6 +39,13 @@ cdef class MemoryPool(_Weakrefable):
30+
31+
cdef void init(self, CMemoryPool* pool):
32+
self.pool = pool
33+
+ # GraalPy change: pyarrow doesn't maintain python references from
34+
+ # buffers to pools, but they dereference the pointer to the pool in the
35+
+ # destructor. They just assume buffers will get GC'ed before their
36+
+ # pools. You can easily get a segfault even on CPython if you make
37+
+ # a buffer outlive its pool. Since we can't guarantee destruction
38+
+ # order, we just leak the pool.
39+
+ Py_INCREF(self)
40+
41+
def release_unused(self):
42+
"""
43+
diff --git a/pyarrow_build_backend.py b/pyarrow_build_backend.py
44+
new file mode 100644
45+
index 0000000..0929c5f
46+
--- /dev/null
47+
+++ b/pyarrow_build_backend.py
48+
@@ -0,0 +1,93 @@
49+
+import os
50+
+import re
51+
+import sys
52+
+import tarfile
53+
+import subprocess
54+
+import tempfile
55+
+import shutil
56+
+import tarfile
57+
+import urllib.request
58+
+from pathlib import Path
59+
+
60+
+VERSION = '19.0.0'
61+
+
62+
+
63+
+def build_sdist(sdist_directory, config_settings=None):
64+
+ nv = f'pyarrow-{VERSION}'
65+
+ srcdir = Path(__file__).parent
66+
+ archive_path = Path(sdist_directory) / f'{nv}.tar.gz'
67+
+
68+
+ def tarfilter(info):
69+
+ if re.match(r'\./(?:.git|venv|[^-/]+-venv|dist)', info.name):
70+
+ return None
71+
+ info.name = f'./{nv}/{info.name}'
72+
+ return info
73+
+
74+
+ with tarfile.open(archive_path, 'w:gz') as tar:
75+
+ tar.add('.', filter=tarfilter)
76+
+ return archive_path.name
77+
+
78+
+
79+
+def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
80+
+ wheel_directory = Path(wheel_directory).absolute()
81+
+ with tempfile.TemporaryDirectory() as tmpdir:
82+
+ tmpdir = Path(tmpdir).absolute()
83+
+ tarname = f'apache-arrow-{VERSION}.tar.gz'
84+
+ tarpath = tmpdir / tarname
85+
+ urllib.request.urlretrieve(f"https://github.com/apache/arrow/archive/refs/tags/{tarname}", tarpath)
86+
+ with tarfile.open(tarpath) as tar:
87+
+ tar.extractall(tmpdir)
88+
+ arrow_dir = tmpdir / f'arrow-apache-arrow-{VERSION}'
89+
+ assert arrow_dir.is_dir()
90+
+ arrow_dist = tmpdir / 'arrow-dist'
91+
+ build_dir = tmpdir / 'arrow-build'
92+
+ subprocess.check_call([
93+
+ 'cmake', '-S', str(arrow_dir / 'cpp'), '-B', str(build_dir),
94+
+ '-DCMAKE_INSTALL_LIBDIR=lib',
95+
+ f'-DCMAKE_INSTALL_PREFIX={arrow_dist}',
96+
+ '-DCMAKE_BUILD_TYPE=Release',
97+
+ '-DARROW_RPATH_ORIGIN=ON',
98+
+ '-DARROW_BUILD_TESTS=OFF',
99+
+ '-DARROW_BUILD_SHARED=ON',
100+
+ '-DARROW_BUILD_STATIC=OFF',
101+
+ # Features
102+
+ '-DARROW_COMPUTE=ON',
103+
+ '-DARROW_CSV=ON',
104+
+ '-DARROW_JSON=ON',
105+
+ '-DARROW_FILESYSTEM=ON',
106+
+ '-DARROW_DATASET=ON',
107+
+ '-DARROW_PARQUET=ON',
108+
+ '-DPARQUET_REQUIRE_ENCRYPTION=ON',
109+
+ '-DARROW_GANDIVA=ON',
110+
+ '-DARROW_WITH_BZ2=ON',
111+
+ '-DARROW_WITH_ZLIB=ON',
112+
+ '-DARROW_WITH_ZSTD=ON',
113+
+ '-DARROW_WITH_LZ4=ON',
114+
+ '-DARROW_WITH_SNAPPY=ON',
115+
+ '-DARROW_WITH_BROTLI=ON',
116+
+ ])
117+
+ subprocess.check_call([
118+
+ 'cmake', '--build', str(build_dir), '--parallel',
119+
+ ])
120+
+ subprocess.check_call([
121+
+ 'cmake', '--install', str(build_dir),
122+
+ ])
123+
+ env = os.environ.copy()
124+
+ env['ARROW_HOME'] = str(arrow_dist)
125+
+ env['CMAKE_PREFIX_PATH'] = str(arrow_dist)
126+
+ env['PYARROW_WITH_DATASET'] = '1'
127+
+ env['PYARROW_WITH_PARQUET'] = '1'
128+
+ env['PYARROW_WITH_PARQUET_ENCRYPTION'] = '1'
129+
+ env['PYARROW_WITH_GANDIVA'] = '1'
130+
+ env['PYARROW_BUNDLE_ARROW_CPP'] = '1'
131+
+ env['PYARROW_BUNDLE_CYTHON_CPP'] = '1'
132+
+ subprocess.run(
133+
+ [sys.executable, 'setup.py', 'bdist_wheel'],
134+
+ env=env,
135+
+ check=True,
136+
+ )
137+
+ wheels = list(Path('dist').glob('*.whl'))
138+
+ assert len(wheels) == 1, f"Expected 1 wheel, found {len(wheels)}"
139+
+ wheel = wheels[0]
140+
+ shutil.copyfile(wheel, wheel_directory / wheel.name)
141+
+ return str(wheel.name)
142+
diff --git a/pyproject.toml b/pyproject.toml
143+
index ef2043f..cb08a86 100644
144+
--- a/pyproject.toml
145+
+++ b/pyproject.toml
146+
@@ -17,7 +17,7 @@
147+
148+
[build-system]
149+
requires = [
150+
- "cython >= 0.29.31",
151+
+ "cython >= 0.29.31, < 3",
152+
# Starting with NumPy 1.25, NumPy is (by default) as far back compatible
153+
# as oldest-support-numpy was (customizable with a NPY_TARGET_VERSION
154+
# define). For older Python versions (where NumPy 1.25 is not yet available)
155+
@@ -29,7 +29,8 @@ requires = [
156+
"setuptools_scm[toml]>=8",
157+
"setuptools>=64",
158+
]
159+
-build-backend = "setuptools.build_meta"
160+
+build-backend = "pyarrow_build_backend"
161+
+backend-path = ["."]
162+
163+
[project]
164+
name = "pyarrow"

0 commit comments

Comments
 (0)