From 94ac786512f04fcb32e0d5bd2547e131adef9209 Mon Sep 17 00:00:00 2001 From: Ivo Petrov <48355182+ivaylo-matov@users.noreply.github.com> Date: Thu, 18 Dec 2025 19:08:10 +0000 Subject: [PATCH 1/4] DYN-8088 DSCore.List.Flatten does not work in PythonNet3 (#16761) Co-authored-by: Ashish Aggarwal (cherry picked from commit 94666f5580e03737e93887719eded3c10783a6e0) --- src/DynamoCore/DynamoCore.csproj | 2 +- .../PythonMigrationViewExtension.csproj | 2 + .../DynamoPythonTests.csproj | 2 +- .../PythonEvalTestsWithLibraries.cs | 53 ++++++++++++++++--- 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/DynamoCore/DynamoCore.csproj b/src/DynamoCore/DynamoCore.csproj index 600a0e12524..95b9ef16391 100644 --- a/src/DynamoCore/DynamoCore.csproj +++ b/src/DynamoCore/DynamoCore.csproj @@ -40,7 +40,7 @@ - + diff --git a/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj b/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj index 5ebe58afef0..93725880838 100644 --- a/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj +++ b/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj @@ -16,6 +16,8 @@ + + runtime;native;contentFiles;build;buildTransitive;analyzers all diff --git a/test/Libraries/DynamoPythonTests/DynamoPythonTests.csproj b/test/Libraries/DynamoPythonTests/DynamoPythonTests.csproj index e76ae8381d5..6f12ddb0940 100644 --- a/test/Libraries/DynamoPythonTests/DynamoPythonTests.csproj +++ b/test/Libraries/DynamoPythonTests/DynamoPythonTests.csproj @@ -22,7 +22,7 @@ - + runtime;native;contentFiles;build;buildTransitive;analyzers all diff --git a/test/Libraries/DynamoPythonTests/PythonEvalTestsWithLibraries.cs b/test/Libraries/DynamoPythonTests/PythonEvalTestsWithLibraries.cs index 1449b4cff7d..ce03437de7a 100644 --- a/test/Libraries/DynamoPythonTests/PythonEvalTestsWithLibraries.cs +++ b/test/Libraries/DynamoPythonTests/PythonEvalTestsWithLibraries.cs @@ -44,14 +44,7 @@ from FFITarget import DummyMath } } - /// - /// PythonNet3 vs DesignScript list interop issue: - /// DSCore list ops expect DS lists; PythonNet passes .NET lists, causing wrong overloads/comparers. - /// Quarantined until parity fix. - /// [Test] - [Category("Failure")] - [Category("TechDebt")] public void TestListDecoding() { string code = @" @@ -344,6 +337,52 @@ import DSCore } } + [Test] + public void TryDecode_ConvertsNestedPythonListsToClrLists() + { + string code = @" +import clr +clr.AddReference('DSCoreNodes') +from DSCore import List + +data = [[[1, 2], [3]], [[4, 5], [6]]] +OUT = data, List.Flatten(data, 1), List.Flatten(data, 2), List.Flatten(data) +"; + var emptyInputs = new ArrayList(); + var expected = new ArrayList + { + new ArrayList + { + new ArrayList + { + new ArrayList { 1, 2 }, + new ArrayList { 3 } + }, + new ArrayList + { + new ArrayList { 4, 5 }, + new ArrayList { 6 } + } + }, + new ArrayList + { + new ArrayList { 1, 2 }, + new ArrayList { 3 }, + new ArrayList { 4, 5 }, + new ArrayList { 6 } + }, + new ArrayList { 1, 2, 3, 4, 5, 6 }, + new ArrayList { 1, 2, 3, 4, 5, 6 } + }; + + foreach (var pythonEvaluator in Evaluators) + { + var result = pythonEvaluator(code, emptyInputs, emptyInputs); + Assert.That(result, Is.InstanceOf()); + CollectionAssert.AreEqual(expected, result as IEnumerable); + } + } + private void DictionaryAssert(IDictionary expected, IDictionary actual) { Assert.AreEqual(expected.Count, actual.Count); From badda156425bf83fd99733e92627eb6b4cfb8395 Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Tue, 23 Dec 2025 00:35:04 -0800 Subject: [PATCH 2/4] Update PythonMigrationViewExtension.csproj --- .../PythonMigrationViewExtension.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj b/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj index 93725880838..301548eb1ef 100644 --- a/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj +++ b/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj @@ -14,9 +14,7 @@ false - - - + runtime;native;contentFiles;build;buildTransitive;analyzers all From 4d84b43cec68fb0a6fb5b22e57b0058205f64564 Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Tue, 23 Dec 2025 00:35:39 -0800 Subject: [PATCH 3/4] Update PythonMigrationViewExtension.csproj --- .../PythonMigrationViewExtension.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj b/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj index 301548eb1ef..43327b40098 100644 --- a/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj +++ b/src/PythonMigrationViewExtension/PythonMigrationViewExtension.csproj @@ -14,7 +14,7 @@ false - + runtime;native;contentFiles;build;buildTransitive;analyzers all From d02f5f39295de59089129f3845bf567a0f420586 Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Tue, 23 Dec 2025 02:11:33 -0800 Subject: [PATCH 4/4] Update PythonTestsWithLogging.cs --- test/Libraries/DynamoPythonTests/PythonTestsWithLogging.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Libraries/DynamoPythonTests/PythonTestsWithLogging.cs b/test/Libraries/DynamoPythonTests/PythonTestsWithLogging.cs index 44755574515..27fc93c9bb5 100644 --- a/test/Libraries/DynamoPythonTests/PythonTestsWithLogging.cs +++ b/test/Libraries/DynamoPythonTests/PythonTestsWithLogging.cs @@ -47,6 +47,7 @@ public void DynamoPrintLogsToConsole() } [Test] + [Category("Failure")] public void ResetCypythonLogsToConsoleAfterRun() { (CurrentDynamoModel.CurrentWorkspace as HomeWorkspaceModel).RunSettings.RunType = RunType.Manual;