Skip to content

Commit 0044e67

Browse files
committed
add cython3 patches for cysignals, cypari2, fpylll, and pplpy
1 parent ad75f66 commit 0044e67

File tree

6 files changed

+155
-0
lines changed

6 files changed

+155
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
commit 8ef356a4eb936c37f55a5c501f3a955e6740c0c5
2+
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
3+
Date: Wed Jul 19 19:45:23 2023 -0300
4+
5+
cython3 support using legacy directives
6+
7+
diff --git a/cypari2/gen.pyx b/cypari2/gen.pyx
8+
index 247b1ad..75050a0 100644
9+
--- a/cypari2/gen.pyx
10+
+++ b/cypari2/gen.pyx
11+
@@ -329,7 +329,7 @@ cdef class Gen(Gen_base):
12+
>>> pari = Pari()
13+
>>> L = pari("vector(10,i,i^2)")
14+
>>> L.__iter__()
15+
- <generator object at ...>
16+
+ <...generator object at ...>
17+
>>> [x for x in L]
18+
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
19+
>>> list(L)
20+
diff --git a/setup.py b/setup.py
21+
index 2188711..455337f 100755
22+
--- a/setup.py
23+
+++ b/setup.py
24+
@@ -36,6 +36,8 @@ class build_ext(_build_ext):
25+
"binding": True,
26+
"cdivision": True,
27+
"language_level": 2,
28+
+ "legacy_implicit_noexcept": True,
29+
+ "c_api_binop_methods": True,
30+
}
31+
32+
_build_ext.finalize_options(self)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/cysignals/signals.pxd.in b/src/cysignals/signals.pxd.in
2+
index c86e085..a98c8d1 100644
3+
--- a/src/cysignals/signals.pxd.in
4+
+++ b/src/cysignals/signals.pxd.in
5+
@@ -54,7 +54,7 @@ cdef extern from "macros.h" nogil:
6+
# can be used to make Cython check whether there is a pending exception
7+
# (PyErr_Occurred() is non-NULL). To Cython, it will look like
8+
# cython_check_exception() actually raised the exception.
9+
-cdef inline void cython_check_exception() nogil except *:
10+
+cdef inline void cython_check_exception() except * nogil:
11+
pass
12+
13+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
commit 9996a4028ddc7f9a5ffda3df65d5b7d3b7df8aa5
2+
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
3+
Date: Wed Jul 19 18:34:57 2023 -0300
4+
5+
cython3 support using legacy directives
6+
7+
diff --git a/setup.py b/setup.py
8+
index 37acdfc..f68270b 100755
9+
--- a/setup.py
10+
+++ b/setup.py
11+
@@ -157,13 +157,17 @@ class build_ext(_build_ext):
12+
# Run Cython with -Werror on continuous integration services
13+
# with Python 3.6 or later
14+
from Cython.Compiler import Options
15+
- Options.warning_errors = True
16+
+ Options.warning_errors = False
17+
18+
from Cython.Build.Dependencies import cythonize
19+
return cythonize(extensions,
20+
build_dir=cythonize_dir,
21+
include_path=["src", os.path.join(cythonize_dir, "src")],
22+
- compiler_directives=dict(binding=True, language_level=2))
23+
+ compiler_directives=dict(
24+
+ binding=True,
25+
+ language_level=2,
26+
+ legacy_implicit_noexcept=True,
27+
+ ))
28+
29+
30+
class build_py(_build_py):
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
commit b6e12c2b0648e84b26dcf0aac507a5b4d9dde301
2+
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
3+
Date: Wed Jul 19 20:38:01 2023 -0300
4+
5+
cython3 support using legacy directives
6+
7+
diff --git a/setup.py b/setup.py
8+
index 274836f..8fc5af5 100755
9+
--- a/setup.py
10+
+++ b/setup.py
11+
@@ -123,7 +123,12 @@ class build_ext(_build_ext, object):
12+
self.extensions,
13+
include_path=["src"],
14+
build_dir=self.cythonize_dir,
15+
- compiler_directives={"binding": True, "embedsignature": True, "language_level": 2},
16+
+ compiler_directives={
17+
+ "binding": True,
18+
+ "embedsignature": True,
19+
+ "language_level": 2,
20+
+ "legacy_implicit_noexcept": True,
21+
+ },
22+
)
23+
super(build_ext, self).run()
24+
25+
diff --git a/src/fpylll/fplll/enumeration_callback_helper.h b/src/fpylll/fplll/enumeration_callback_helper.h
26+
index c099430..706162f 100644
27+
--- a/src/fpylll/fplll/enumeration_callback_helper.h
28+
+++ b/src/fpylll/fplll/enumeration_callback_helper.h
29+
@@ -5,7 +5,7 @@
30+
#include <Python.h>
31+
#include <fplll/fplll.h>
32+
33+
-extern "C" {
34+
+extern "C++" {
35+
bool evaluator_callback_call_obj(PyObject *obj, int n, double *new_sol_coord);
36+
}
37+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
commit e6f3e66154138ce3e31e803e74b8c71787c70acc
2+
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
3+
Date: Wed Jul 19 20:47:52 2023 -0300
4+
5+
cython3 support using legacy directives
6+
7+
diff --git a/setup.py b/setup.py
8+
index 13d543b..55dcd34 100755
9+
--- a/setup.py
10+
+++ b/setup.py
11+
@@ -38,7 +38,11 @@ class build_ext(_build_ext):
12+
self.extensions[:] = cythonize(
13+
self.extensions,
14+
include_path=sys.path,
15+
- compiler_directives={'embedsignature': True})
16+
+ compiler_directives={
17+
+ 'embedsignature': True,
18+
+ 'legacy_implicit_noexcept': True,
19+
+ 'c_api_binop_methods': True,
20+
+ })
21+
22+
_build_ext.run(self)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
From aaa28537fa7ea061ebb8d5131b1e23673eaf741d Mon Sep 17 00:00:00 2001
2+
From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
3+
Date: Sun, 31 Jul 2022 12:39:34 -0700
4+
Subject: [PATCH] ppl/bit_arrays.pxd: Use relative cimport
5+
6+
---
7+
ppl/bit_arrays.pxd | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/ppl/bit_arrays.pxd b/ppl/bit_arrays.pxd
11+
index eb57434..145a978 100644
12+
--- a/ppl/bit_arrays.pxd
13+
+++ b/ppl/bit_arrays.pxd
14+
@@ -1,4 +1,4 @@
15+
-from ppl_decl cimport *
16+
+from .ppl_decl cimport *
17+
18+
cdef class Bit_Row(object):
19+
cdef PPL_Bit_Row *thisptr
20+
--
21+
GitLab

0 commit comments

Comments
 (0)