Skip to content

Commit 001d770

Browse files
committed
use compile_time_env option in cythonize for PY_MAJOR_VERSION
1 parent 418cf40 commit 001d770

File tree

4 files changed

+2
-14
lines changed

4 files changed

+2
-14
lines changed

cypari2/convert.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ from .stack cimport new_gen
5555
cdef extern from *:
5656
Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
5757

58-
include "system.pxi"
59-
6058
####################################
6159
# Integers
6260
####################################

cypari2/gen.pyx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ from .pari_instance cimport (prec_bits_to_words, prec_words_to_bits,
8484
from .stack cimport new_gen, new_gen_noclear, clear_stack
8585
from .closure cimport objtoclosure
8686

87-
8887
include 'auto_gen.pxi'
89-
include 'system.pxi'
90-
9188

9289
@cython.final
9390
cdef class Gen(Gen_auto):

cypari2/pari_instance.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ from .convert cimport new_gen_from_double
239239
from .handle_error cimport _pari_init_error_handling
240240
from .closure cimport _pari_init_closure
241241

242-
include "system.pxi"
243-
244242
# Default precision (in PARI words) for the PARI library interface,
245243
# when no explicit precision is given and the inputs are exact.
246244
cdef long prec = prec_bits_to_words(53)

setup.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@ def finalize_options(self):
2828
from autogen import rebuild
2929
rebuild()
3030

31-
# Write compilation constants in system.pxi
32-
import sys
33-
with open('cypari2/system.pxi', 'w') as output:
34-
output.write('DEF PY_MAJOR_VERSION = %d\n' % sys.version_info.major)
35-
output.write('DEF PY_MINOR_VERSION = %d\n' % sys.version_info.minor)
36-
3731
self.distribution.ext_modules[:] = cythonize(
38-
self.distribution.ext_modules, include_path=sys.path)
32+
self.distribution.ext_modules, include_path=sys.path,
33+
compile_time_env={'PY_MAJOR_VERSION': sys.version_info.major})
3934
_build_ext.finalize_options(self)
4035

4136

0 commit comments

Comments
 (0)