Skip to content

Commit 0b04266

Browse files
committed
[GR-43510] cythonize in proc
PullRequest: graalpython/2623
2 parents 2494d46 + ae20ddc commit 0b04266

File tree

7 files changed

+1499
-28
lines changed

7 files changed

+1499
-28
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import subprocess
4343
import sys
4444
import test
45+
from itertools import zip_longest
4546

4647
if os.environ.get("ENABLE_CPYTHON_TAGGED_UNITTESTS") == "true" or __name__ == "__main__":
4748
TAGS_DIR = os.path.join(os.path.dirname(__file__), "unittest_tags")
@@ -52,6 +53,12 @@
5253
RUNNER = os.path.join(os.path.dirname(__file__), "run_cpython_test.py")
5354
LINE = "=" * 80
5455

56+
57+
def grouper(iterable, n):
58+
args = [iter(iterable)] * n
59+
return zip_longest(*args, fillvalue=None)
60+
61+
5562
def working_selectors(tagfile):
5663
if os.path.exists(tagfile):
5764
with open(tagfile) as f:
@@ -77,29 +84,30 @@ def collect_working_tests():
7784
def make_test_function(working_test):
7885
testmod = working_test[0].rpartition(".")[2]
7986

80-
def test_tagged():
81-
cmd = [sys.executable]
82-
if "--inspect" in sys.argv:
83-
cmd.append("--inspect")
84-
if "-debug-java" in sys.argv:
85-
cmd.append("-debug-java")
86-
cmd += [RUNNER]
87-
if "-vv" in sys.argv:
88-
cmd += ['-v']
89-
for testpattern in working_test[1]:
90-
cmd.extend(["-k", testpattern])
91-
print("Running test:", working_test[0])
92-
testfile = os.path.join(os.path.dirname(test.__file__), "%s.py" % testmod)
93-
if not os.path.isfile(testfile):
94-
testfile = os.path.join(os.path.dirname(test.__file__), "%s/__init__.py" % testmod)
95-
cmd.append(testfile)
96-
if os.environ.get("ENABLE_THREADED_GRAALPYTEST") == "true":
97-
run_serialize_out(cmd)
98-
else:
99-
rcode = run_with_timeout(cmd).returncode
100-
if rcode:
101-
raise CalledProcessError(rcode, cmd)
102-
print(working_test[0], "was finished.")
87+
def test_tagged(max_patterns=100):
88+
for working_test_group in grouper(working_test[1], max_patterns):
89+
cmd = [sys.executable]
90+
if "--inspect" in sys.argv:
91+
cmd.append("--inspect")
92+
if "-debug-java" in sys.argv:
93+
cmd.append("-debug-java")
94+
cmd += [RUNNER]
95+
if "-vv" in sys.argv:
96+
cmd += ['-v']
97+
for testpattern in working_test_group:
98+
cmd.extend(["-k", testpattern])
99+
print("Running test:", working_test[0])
100+
testfile = os.path.join(os.path.dirname(test.__file__), "%s.py" % testmod)
101+
if not os.path.isfile(testfile):
102+
testfile = os.path.join(os.path.dirname(test.__file__), "%s/__init__.py" % testmod)
103+
cmd.append(testfile)
104+
if os.environ.get("ENABLE_THREADED_GRAALPYTEST") == "true":
105+
run_serialize_out(cmd)
106+
else:
107+
rcode = run_with_timeout(cmd).returncode
108+
if rcode:
109+
raise CalledProcessError(rcode, cmd)
110+
print(working_test[0], "was finished.")
103111

104112
def run_serialize_out(cmd):
105113
result = run_with_timeout(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -400,7 +400,7 @@ def make_site_cfg(root):
400400
append_env_var(numpy_build_env, 'CFLAGS', '-Wno-error=implicit-function-declaration')
401401
info(f"have lapack or blas ... CLFAGS={numpy_build_env['CFLAGS']}")
402402

403-
install_from_pypi("numpy==1.23.1", build_cmd=["build_ext", "--disable-optimization"], env=numpy_build_env,
403+
install_from_pypi("numpy==1.23.5", build_cmd=["build_ext", "--disable-optimization"], env=numpy_build_env,
404404
pre_install_hook=make_site_cfg, **kwargs)
405405

406406
# print numpy configuration
@@ -455,7 +455,7 @@ def pandas(**kwargs):
455455
dateutil(**kwargs)
456456
numpy(**kwargs)
457457

458-
install_from_pypi("pandas==1.4.3", **kwargs)
458+
install_from_pypi("pandas==1.5.2", **kwargs)
459459

460460
@pip_package()
461461
def scipy(**kwargs):
@@ -503,7 +503,7 @@ def scikit_learn(**kwargs):
503503
joblib(**kwargs)
504504
threadpoolctl(**kwargs)
505505

506-
install_from_pypi("scikit-learn==1.0.2", env=scikit_learn_build_env, **kwargs)
506+
install_from_pypi("scikit-learn==1.1.3", env=scikit_learn_build_env, **kwargs)
507507

508508
@pip_package()
509509
def cycler(**kwargs):

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
diff --git a/Cython/Utility/Coroutine.c b/Cython/Utility/Coroutine.c
2+
index 1ad27df..0965cb2 100644
3+
--- a/Cython/Utility/Coroutine.c
4+
+++ b/Cython/Utility/Coroutine.c
5+
@@ -1299,7 +1299,7 @@ static void __Pyx_Coroutine_del(PyObject *self) {
6+
_Py_NewReference(self);
7+
__Pyx_SET_REFCNT(self, refcnt);
8+
}
9+
-#if CYTHON_COMPILING_IN_CPYTHON
10+
+#if CYTHON_COMPILING_IN_CPYTHON && !GRAALVM_PYTHON
11+
assert(PyType_IS_GC(Py_TYPE(self)) &&
12+
_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
13+
114
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
215
index f8bf885..9c2534d 100644
316
--- a/Cython/Utility/ModuleSetupCode.c

0 commit comments

Comments
 (0)