FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Revert "Release the GIL" · sdpython/pythonnet@308f0f2 · GitHub

This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Repository navigation

Commit 308f0f2

Browse files
committed
Revert "Release the GIL"
This reverts commit 7ec9a6c.
1 parent eb8cb8a commit 308f0f2

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

‎src/embed_tests/TestRuntime.cs‎

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,16 @@ public static void PlatformCache()
4040
[Test]
4141
public static void Py_IsInitializedValue()
4242
{
43-
IntPtr state = IntPtr.Zero;
44-
try
43+
if (Runtime.Runtime.Py_IsInitialized() == 1)
4544
{
46-
if (Runtime.Runtime.Py_IsInitialized() == 1)
47-
{
48-
state = Runtime.Runtime.PyGILState_Ensure();
49-
}
50-
Runtime.Runtime.Py_Finalize();
51-
Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized());
52-
Runtime.Runtime.Py_Initialize();
53-
Assert.AreEqual(1, Runtime.Runtime.Py_IsInitialized());
54-
Runtime.Runtime.Py_Finalize();
55-
Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized());
56-
}
57-
finally
58-
{
59-
if(state != IntPtr.Zero)
60-
{
61-
Runtime.Runtime.PyGILState_Release(state);
62-
}
45+
Runtime.Runtime.PyGILState_Ensure();
6346
}
47+
Runtime.Runtime.Py_Finalize();
48+
Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized());
49+
Runtime.Runtime.Py_Initialize();
50+
Assert.AreEqual(1, Runtime.Runtime.Py_IsInitialized());
51+
Runtime.Runtime.Py_Finalize();
52+
Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized());
6453
}
6554

6655
[Test]

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL