Skip to content

Commit 060374b

Browse files
committed
Update Cython patch to recythonize files after unpatched Cython
1 parent a792079 commit 060374b

File tree

3 files changed

+80
-8
lines changed

3 files changed

+80
-8
lines changed

graalpython/lib-graalpython/patches/Cython/Cython-0.29.32.patch

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py
2-
index 7eb55e2..76d4857 100644
2+
index 7eb55e2..1fbab30 100644
33
--- a/Cython/Build/Dependencies.py
44
+++ b/Cython/Build/Dependencies.py
5-
@@ -1094,6 +1094,8 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
5+
@@ -1060,6 +1060,12 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
6+
else:
7+
dep_timestamp, dep = deps.newest_dependency(source)
8+
priority = 2 - (dep in deps.immediate_dependencies(source))
9+
+ # GraalPy change: force recythonize if not cythonized by our patched version
10+
+ if os.path.exists(c_file):
11+
+ with open(c_file, 'rb') as f:
12+
+ # We modify the watermark to include graalpy
13+
+ if not b'graalpy' in f.read(100):
14+
+ c_timestamp = -1
15+
if force or c_timestamp < dep_timestamp:
16+
if not quiet and not force:
17+
if source == dep:
18+
@@ -1094,6 +1100,8 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
619
progress = progress_fmt.format(i+1, N)
720
to_compile[i] = to_compile[i][1:] + (progress,)
821

@@ -101,6 +114,17 @@ index 7361a55..6c4d9d9 100644
101114
entry.in_cinclude = self.in_cinclude
102115
entry.create_wrapper = create_wrapper
103116
if name:
117+
diff --git a/Cython/Compiler/Version.py b/Cython/Compiler/Version.py
118+
index dcb561f..c2c06a0 100644
119+
--- a/Cython/Compiler/Version.py
120+
+++ b/Cython/Compiler/Version.py
121+
@@ -6,4 +6,5 @@ from .. import __version__ as version
122+
123+
# For 'generated by' header line in C files.
124+
125+
-watermark = str(version)
126+
+# GraalPy change: watermark our patched version
127+
+watermark = f'{version}-graalpy'
104128
diff --git a/Cython/Includes/cpython/datetime.pxd b/Cython/Includes/cpython/datetime.pxd
105129
index cd0f907..712cd92 100644
106130
--- a/Cython/Includes/cpython/datetime.pxd

graalpython/lib-graalpython/patches/Cython/Cython-0.29.37.patch

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py
2-
index 92fa96a..2885a4f 100644
2+
index 92fa96a..8864b78 100644
33
--- a/Cython/Build/Dependencies.py
44
+++ b/Cython/Build/Dependencies.py
5-
@@ -1082,6 +1082,8 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
5+
@@ -1048,6 +1048,12 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
6+
else:
7+
dep_timestamp, dep = deps.newest_dependency(source)
8+
priority = 2 - (dep in deps.immediate_dependencies(source))
9+
+ # GraalPy change: force recythonize if not cythonized by our patched version
10+
+ if os.path.exists(c_file):
11+
+ with open(c_file, 'rb') as f:
12+
+ # We modify the watermark to include graalpy
13+
+ if not b'graalpy' in f.read(100):
14+
+ c_timestamp = -1
15+
if force or c_timestamp < dep_timestamp:
16+
if not quiet and not force:
17+
if source == dep:
18+
@@ -1082,6 +1088,8 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
619
progress = progress_fmt.format(i+1, N)
720
to_compile[i] = to_compile[i][1:] + (progress,)
821

@@ -101,6 +114,17 @@ index 7361a55..6c4d9d9 100644
101114
entry.in_cinclude = self.in_cinclude
102115
entry.create_wrapper = create_wrapper
103116
if name:
117+
diff --git a/Cython/Compiler/Version.py b/Cython/Compiler/Version.py
118+
index dcb561f..c2c06a0 100644
119+
--- a/Cython/Compiler/Version.py
120+
+++ b/Cython/Compiler/Version.py
121+
@@ -6,4 +6,5 @@ from .. import __version__ as version
122+
123+
# For 'generated by' header line in C files.
124+
125+
-watermark = str(version)
126+
+# GraalPy change: watermark our patched version
127+
+watermark = f'{version}-graalpy'
104128
diff --git a/Cython/Includes/cpython/datetime.pxd b/Cython/Includes/cpython/datetime.pxd
105129
index cd0f907..712cd92 100644
106130
--- a/Cython/Includes/cpython/datetime.pxd
@@ -154,7 +178,7 @@ index 099b3c4..0692df0 100644
154178
cval = ((PyComplexObject *)o)->cval;
155179
else
156180
diff --git a/Cython/Utility/Coroutine.c b/Cython/Utility/Coroutine.c
157-
index aaa8a8e..152e9dc 100644
181+
index aaa8a8e..e60a5e0 100644
158182
--- a/Cython/Utility/Coroutine.c
159183
+++ b/Cython/Utility/Coroutine.c
160184
@@ -531,8 +531,7 @@ static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *$lo
@@ -221,7 +245,7 @@ index 93f577f..5dac1d7 100644
221245
#endif
222246
else if (PyMethod_Check(method)) {
223247
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
224-
index cfff606..4a6a6ea 100644
248+
index cfff606..90876c6 100644
225249
--- a/Cython/Utility/ModuleSetupCode.c
226250
+++ b/Cython/Utility/ModuleSetupCode.c
227251
@@ -186,6 +186,48 @@

graalpython/lib-graalpython/patches/Cython/Cython-3.0.10.patch

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py
2-
index 7de4065..e1589cd 100644
2+
index 7de4065..981011f 100644
33
--- a/Cython/Build/Dependencies.py
44
+++ b/Cython/Build/Dependencies.py
5-
@@ -1127,6 +1127,8 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
5+
@@ -1090,6 +1090,12 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
6+
else:
7+
dep_timestamp, dep = deps.newest_dependency(source)
8+
priority = 2 - (dep in deps.immediate_dependencies(source))
9+
+ # GraalPy change: force recythonize if not cythonized by our patched version
10+
+ if os.path.exists(c_file):
11+
+ with open(c_file, 'rb') as f:
12+
+ # We modify the watermark to include graalpy
13+
+ if not b'graalpy' in f.read(100):
14+
+ c_timestamp = -1
15+
if force or c_timestamp < dep_timestamp:
16+
if not quiet and not force:
17+
if source == dep:
18+
@@ -1127,6 +1133,8 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
619
progress = progress_fmt.format(i+1, N)
720
to_compile[i] = to_compile[i][1:] + (progress,)
821

@@ -103,6 +116,17 @@ index 5f088dd..a258bdc 100644
103116
entry.in_cinclude = self.in_cinclude
104117
entry.create_wrapper = create_wrapper
105118
if name:
119+
diff --git a/Cython/Compiler/Version.py b/Cython/Compiler/Version.py
120+
index dcb561f..c2c06a0 100644
121+
--- a/Cython/Compiler/Version.py
122+
+++ b/Cython/Compiler/Version.py
123+
@@ -6,4 +6,5 @@ from .. import __version__ as version
124+
125+
# For 'generated by' header line in C files.
126+
127+
-watermark = str(version)
128+
+# GraalPy change: watermark our patched version
129+
+watermark = f'{version}-graalpy'
106130
diff --git a/Cython/Includes/cpython/datetime.pxd b/Cython/Includes/cpython/datetime.pxd
107131
index 3dce395..77f8356 100644
108132
--- a/Cython/Includes/cpython/datetime.pxd

0 commit comments

Comments
 (0)