From c17f5119abc71be487ba33ca51d1f034dc016dd5 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Thu, 13 Jul 2023 07:44:00 -0400 Subject: [PATCH 1/9] Removed redundant include statements --- .../main/java/org/lflang/generator/python/PythonGenerator.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/python/PythonGenerator.java b/core/src/main/java/org/lflang/generator/python/PythonGenerator.java index b8b3a74282..3bdb42162d 100644 --- a/core/src/main/java/org/lflang/generator/python/PythonGenerator.java +++ b/core/src/main/java/org/lflang/generator/python/PythonGenerator.java @@ -489,9 +489,6 @@ protected void generateUserPreamblesForReactor(Reactor reactor, CodeBuilder src) @Override protected void generateReactorClassHeaders( TypeParameterizedReactor tpr, String headerName, CodeBuilder header, CodeBuilder src) { - header.pr( - PythonPreambleGenerator.generateCIncludeStatements( - targetConfig, targetLanguageIsCpp(), hasModalReactors)); super.generateReactorClassHeaders(tpr, headerName, header, src); } From c787a0c4a633b9ac1a08e901e0b3b0ee30ea40a9 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Thu, 13 Jul 2023 07:44:30 -0400 Subject: [PATCH 2/9] include Python.h before other includes --- .../org/lflang/generator/python/PythonPreambleGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/generator/python/PythonPreambleGenerator.java b/core/src/main/java/org/lflang/generator/python/PythonPreambleGenerator.java index bd1291425f..6ea76fd845 100644 --- a/core/src/main/java/org/lflang/generator/python/PythonPreambleGenerator.java +++ b/core/src/main/java/org/lflang/generator/python/PythonPreambleGenerator.java @@ -45,8 +45,8 @@ public static String generateCDefineDirectives( public static String generateCIncludeStatements( TargetConfig targetConfig, boolean CCppMode, boolean hasModalReactors) { CodeBuilder code = new CodeBuilder(); - code.pr(CPreambleGenerator.generateIncludeStatements(targetConfig, CCppMode)); code.pr("#include \"pythontarget.h\""); + code.pr(CPreambleGenerator.generateIncludeStatements(targetConfig, CCppMode)); if (hasModalReactors) { code.pr("#include \"include/modal_models/definitions.h\""); } From ddcb6a95461a429f0a07fe52aa0038dedafbfcf6 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Thu, 13 Jul 2023 07:45:05 -0400 Subject: [PATCH 3/9] Align to python-11 reactor-c branch --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index ac3f64993d..c0d4be3de4 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit ac3f64993d40d8db2ee5e3af3fb10cbb8035b7c1 +Subproject commit c0d4be3de4f5105a56245968119c067deb884a33 From f3956484e3ade0c3d5afb4dadae0adf683fbf3dd Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 15 Jul 2023 08:50:56 -0400 Subject: [PATCH 4/9] Require Python 3.11 --- .../main/java/org/lflang/generator/python/PythonGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/generator/python/PythonGenerator.java b/core/src/main/java/org/lflang/generator/python/PythonGenerator.java index 3bdb42162d..2b93b37276 100644 --- a/core/src/main/java/org/lflang/generator/python/PythonGenerator.java +++ b/core/src/main/java/org/lflang/generator/python/PythonGenerator.java @@ -575,7 +575,7 @@ private static String setUpMainTarget( add_subdirectory(core) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}) set(LF_MAIN_TARGET ) - find_package(Python 3.7.0...<3.11.0 COMPONENTS Interpreter Development) + find_package(Python 3.11.0...<3.12.0 COMPONENTS Interpreter Development) Python_add_library( ${LF_MAIN_TARGET} MODULE From 3bc9562da591deea3e7d89d75509c5adbd4ef987 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sat, 15 Jul 2023 13:36:11 -0700 Subject: [PATCH 5/9] Update py-tests.yml Bump Python installation from `3.10` to `3.11` --- .github/workflows/py-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/py-tests.yml b/.github/workflows/py-tests.yml index 191e2e1929..c39d120691 100644 --- a/.github/workflows/py-tests.yml +++ b/.github/workflows/py-tests.yml @@ -39,7 +39,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies OS X run: | brew install coreutils From dbbb809ada8d283715c7dd23562a26dfd0dc160d Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Wed, 19 Jul 2023 18:50:49 -0400 Subject: [PATCH 6/9] Avoid segfault on invalid python code in reaction --- .../org/lflang/generator/python/PythonReactionGenerator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java b/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java index c65d4ad3de..77dac930b9 100644 --- a/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java +++ b/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java @@ -118,7 +118,8 @@ private static String generateCPythonFunctionCaller( + " code again", " }", " " + PyUtil.generateGILReleaseCode(), - " Py_FinalizeEx();", + // The following causes a segmentation fault: + // " Py_FinalizeEx();", " exit(1);", "}", "", From f0566b92033311433a821629b7579991ec0d32ab Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 26 Jul 2023 10:43:35 +0200 Subject: [PATCH 7/9] remove commented out code --- .../org/lflang/generator/python/PythonReactionGenerator.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java b/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java index 77dac930b9..892ab0acd3 100644 --- a/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java +++ b/core/src/main/java/org/lflang/generator/python/PythonReactionGenerator.java @@ -118,8 +118,6 @@ private static String generateCPythonFunctionCaller( + " code again", " }", " " + PyUtil.generateGILReleaseCode(), - // The following causes a segmentation fault: - // " Py_FinalizeEx();", " exit(1);", "}", "", From 0d5b0e200e335765d9fb0b9e013a72bf6e4c0fb8 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 26 Jul 2023 14:06:12 +0200 Subject: [PATCH 8/9] test both Python 3.10 and 3.11 --- .github/workflows/py-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/py-tests.yml b/.github/workflows/py-tests.yml index c39d120691..013baea752 100644 --- a/.github/workflows/py-tests.yml +++ b/.github/workflows/py-tests.yml @@ -22,6 +22,7 @@ jobs: strategy: matrix: platform: ${{ (inputs.all-platforms && fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]')) || fromJSON('["ubuntu-latest"]') }} + python-version: ${{ (inputs.all-platforms && fromJSON('["3.10", "3.11"]')) || fromJSON('["3.11"]') }} runs-on: ${{ matrix.platform }} steps: - name: Check out lingua-franca repository @@ -39,7 +40,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install dependencies OS X run: | brew install coreutils From c276b518446f151393687cc7e77d82dc235ae431 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 21 Oct 2023 09:54:05 -0700 Subject: [PATCH 9/9] Align reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 654fa0cbff..eab52f47db 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 654fa0cbff6510787d5a146672eba8f868b2464c +Subproject commit eab52f47db2a8b5c03ca2ab5509411a281c7f872