Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76d86eb

Browse files
committed
improved perf tests Python initialization
1 parent 9ac31d6 commit 76d86eb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/perf_tests/BaselineComparisonBenchmarkBase.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ public BaselineComparisonBenchmarkBase()
1313
{
1414
Console.WriteLine($"CWD: {Environment.CurrentDirectory}");
1515
Console.WriteLine($"Using Python.Runtime from {typeof(PythonEngine).Assembly.Location} {typeof(PythonEngine).Assembly.GetName()}");
16-
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
17-
if (assembly.FullName.StartsWith("Python.Runtime"))
18-
Console.WriteLine(assembly.Location);
19-
foreach (var dependency in assembly.GetReferencedAssemblies())
20-
if (dependency.FullName.Contains("Python.Runtime")) {
21-
Console.WriteLine($"{assembly} -> {dependency}");
22-
}
16+
17+
try {
18+
PythonEngine.Initialize();
19+
Console.WriteLine("Python Initialized");
20+
if (PythonEngine.BeginAllowThreads() == IntPtr.Zero)
21+
throw new PythonException();
22+
Console.WriteLine("Threading enabled");
23+
}
24+
catch (Exception e) {
25+
Console.WriteLine(e);
26+
throw;
2327
}
24-
PythonEngine.Initialize();
2528
}
2629

2730
static BaselineComparisonBenchmarkBase()

0 commit comments

Comments
 (0)