cython

Форк
0
/
abitests.srctree 
83 строки · 1.6 Кб
1
# These tests aren't perfect because they just mislead some of the Cython
2
# code about the build environment - they don't actually manage to
3
# simulate getting the environment wrong in the Python headers (which
4
# is potentially a more dramatic problem).
5

6
PYTHON setup.py build_ext --inplace
7
PYTHON test.py
8

9
##################### setup.py #########################
10

11

12
from setuptools import setup
13
from Cython.Build import cythonize
14

15
setup(
16
    ext_modules = cythonize("*.pyx")
17
)
18

19
##################### test.py ###########################
20

21
import sys
22

23
if sys.implementation.name != 'cpython':
24
    exit(0)
25

26
if sys.version_info < (3, 8):
27
    try:
28
        import debug
29
        assert False, "Failed 'debug' test"
30
    except ImportError:
31
        pass
32
    
33
if sys.version_info >= (3, 13):
34
    try:
35
        import freethread
36
        assert False, "Failed 'freethread' test"
37
    except ImportError:
38
        pass
39
        
40
try:
41
    import trace
42
    assert False, "Failed 'trace' test"
43
except ImportError:
44
    pass
45

46
##################### debug.pyx #########################
47

48
cdef extern from *:
49
    """
50
    #ifdef Py_DEBUG
51
    #undef Py_DEBUG
52
    #else
53
    #define Py_DEBUG
54
    #endif
55
    """
56
    
57
something = 1
58

59
##################### freethread.pyx ###################
60

61
cdef extern from *:
62
    """
63
    #ifdef Py_GIL_DISABLED
64
    #undef Py_GIL_DISABLED
65
    #else
66
    #define Py_GIL_DISABLED
67
    #endif
68
    """
69
    
70
something = 1
71

72
#################### trace.pyx #########################
73

74
cdef extern from *:
75
    """
76
    #ifdef Py_TRACE_REFS
77
    #undef Py_TRACE_REFS
78
    #else
79
    #define Py_TRACE_REFS
80
    #endif
81
    """
82
    
83
something = 1
84

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.