Commit f40b91af authored by da-woods's avatar da-woods Committed by GitHub

Enable initial testing with GraalPython (GH-4328)

Very little works at present, there looks to be huge memory-leaks,
and the test-suite runs very slowly. It definitely isn't worth adding
anything on Github Actions at this stage.

It's just designed to get over the initial hurdle so that it
can be tested and improvements can be made if anyone is
inclined.
parent 7bdffa26
...@@ -53,10 +53,67 @@ ...@@ -53,10 +53,67 @@
#define Py_HUGE_VAL HUGE_VAL #define Py_HUGE_VAL HUGE_VAL
#endif #endif
#ifdef PYPY_VERSION #if defined(GRAALVM_PYTHON)
/* For very preliminary testing purposes. Most variables are set the same as PyPy.
The existence of this section does not imply that anything works or is even tested */
// GRAALVM_PYTHON test comes before PyPy test because GraalPython unhelpfully defines PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 0
#define CYTHON_COMPILING_IN_LIMITED_API 0
#define CYTHON_COMPILING_IN_GRAAL 1
#undef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 0
#undef CYTHON_USE_TYPE_SPECS
#define CYTHON_USE_TYPE_SPECS 0
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#if PY_VERSION_HEX < 0x03050000
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
#define CYTHON_USE_ASYNC_SLOTS 1
#endif
#undef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 0
#undef CYTHON_USE_UNICODE_INTERNALS
#define CYTHON_USE_UNICODE_INTERNALS 0
#undef CYTHON_USE_UNICODE_WRITER
#define CYTHON_USE_UNICODE_WRITER 0
#undef CYTHON_USE_PYLONG_INTERNALS
#define CYTHON_USE_PYLONG_INTERNALS 0
#undef CYTHON_AVOID_BORROWED_REFS
#define CYTHON_AVOID_BORROWED_REFS 1
#undef CYTHON_ASSUME_SAFE_MACROS
#define CYTHON_ASSUME_SAFE_MACROS 0
#undef CYTHON_UNPACK_METHODS
#define CYTHON_UNPACK_METHODS 0
#undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_GIL
#define CYTHON_FAST_GIL 0
#undef CYTHON_METH_FASTCALL
#define CYTHON_METH_FASTCALL 0
#undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0
#ifndef CYTHON_PEP487_INIT_SUBCLASS
#define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
#endif
#undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 1
#undef CYTHON_USE_MODULE_STATE
#define CYTHON_USE_MODULE_STATE 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#undef CYTHON_USE_DICT_VERSIONS
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYPY_VERSION)
#define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_CPYTHON 0
#define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_LIMITED_API 0
#define CYTHON_COMPILING_IN_GRAAL 0
#undef CYTHON_USE_TYPE_SLOTS #undef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 0 #define CYTHON_USE_TYPE_SLOTS 0
...@@ -105,12 +162,12 @@ ...@@ -105,12 +162,12 @@
#define CYTHON_USE_DICT_VERSIONS 0 #define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK #undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0 #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(CYTHON_LIMITED_API) #elif defined(CYTHON_LIMITED_API)
// EXPERIMENTAL !! // EXPERIMENTAL !!
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_CPYTHON 0
#define CYTHON_COMPILING_IN_LIMITED_API 1 #define CYTHON_COMPILING_IN_LIMITED_API 1
#define CYTHON_COMPILING_IN_GRAAL 0
#undef CYTHON_USE_TYPE_SLOTS #undef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 0 #define CYTHON_USE_TYPE_SLOTS 0
...@@ -158,11 +215,11 @@ ...@@ -158,11 +215,11 @@
#define CYTHON_USE_DICT_VERSIONS 0 #define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK #undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0 #define CYTHON_USE_EXC_INFO_STACK 0
#else #else
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_CPYTHON 1
#define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_LIMITED_API 0
#define CYTHON_COMPILING_IN_GRAAL 0
#ifndef CYTHON_USE_TYPE_SLOTS #ifndef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 1 #define CYTHON_USE_TYPE_SLOTS 1
......
...@@ -28,9 +28,11 @@ try: ...@@ -28,9 +28,11 @@ try:
import platform import platform
IS_PYPY = platform.python_implementation() == 'PyPy' IS_PYPY = platform.python_implementation() == 'PyPy'
IS_CPYTHON = platform.python_implementation() == 'CPython' IS_CPYTHON = platform.python_implementation() == 'CPython'
IS_GRAAL = platform.python_implementation() == 'GraalVM'
except (ImportError, AttributeError): except (ImportError, AttributeError):
IS_CPYTHON = True IS_CPYTHON = True
IS_PYPY = False IS_PYPY = False
IS_GRAAL = False
IS_PY2 = sys.version_info[0] < 3 IS_PY2 = sys.version_info[0] < 3
CAN_SYMLINK = sys.platform != 'win32' and hasattr(os, 'symlink') CAN_SYMLINK = sys.platform != 'win32' and hasattr(os, 'symlink')
...@@ -2026,7 +2028,8 @@ class MissingDependencyExcluder(object): ...@@ -2026,7 +2028,8 @@ class MissingDependencyExcluder(object):
except AttributeError: except AttributeError:
stdlib_dir = os.path.dirname(shutil.__file__) + os.sep stdlib_dir = os.path.dirname(shutil.__file__) + os.sep
module_path = getattr(module, '__file__', stdlib_dir) # no __file__? => builtin stdlib module module_path = getattr(module, '__file__', stdlib_dir) # no __file__? => builtin stdlib module
if module_path.startswith(stdlib_dir): # GraalPython seems to return None for some unknown reason
if module_path and module_path.startswith(stdlib_dir):
# stdlib module # stdlib module
version = sys.version.partition(' ')[0] version = sys.version.partition(' ')[0]
elif '.' in name: elif '.' in name:
...@@ -2658,6 +2661,7 @@ def runtests(options, cmd_args, coverage=None): ...@@ -2658,6 +2661,7 @@ def runtests(options, cmd_args, coverage=None):
('pypy2_bugs.txt', IS_PYPY and IS_PY2), ('pypy2_bugs.txt', IS_PYPY and IS_PY2),
('pypy_crash_bugs.txt', IS_PYPY), ('pypy_crash_bugs.txt', IS_PYPY),
('pypy_implementation_detail_bugs.txt', IS_PYPY), ('pypy_implementation_detail_bugs.txt', IS_PYPY),
('graal_bugs.txt', IS_GRAAL),
('limited_api_bugs.txt', options.limited_api), ('limited_api_bugs.txt', options.limited_api),
('windows_bugs.txt', sys.platform == 'win32'), ('windows_bugs.txt', sys.platform == 'win32'),
('cygwin_bugs.txt', sys.platform == 'cygwin') ('cygwin_bugs.txt', sys.platform == 'cygwin')
......
...@@ -26,7 +26,9 @@ osx_on_ci = (sys.platform == "darwin" and os.getenv("CI")) ...@@ -26,7 +26,9 @@ osx_on_ci = (sys.platform == "darwin" and os.getenv("CI"))
# Test concurrent safety if multiprocessing is available. # Test concurrent safety if multiprocessing is available.
# (In particular, CI providers like Travis and Github Actions do not support spawning processes from tests.) # (In particular, CI providers like Travis and Github Actions do not support spawning processes from tests.)
nthreads = 0 nthreads = 0
if not (hasattr(sys, 'pypy_version_info') or osx_on_ci): if not (hasattr(sys, 'pypy_version_info') or
(hasattr(sys, 'implementation') and sys.implementation.name == 'graalpython') or
osx_on_ci):
try: try:
import multiprocessing import multiprocessing
multiprocessing.Pool(2).close() multiprocessing.Pool(2).close()
......
# This list is definitely not complete!
cythonize_script_package # runs forever, probably multiprocessing issues
callingconvention # gets stuck and runs forever
different_package_names # gets stuck and runs forever
duplicate_utilitycode_from_pyx
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment