Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitedc7621

Browse files
authored
Fix PythonException GC (#400)
Since PythonException doesn't inherit from PyObject, need to reapplythe same fix as from gh:365.Seen mostly on PY27/Travis on PyTuple tests.Enable PyTuple tests for PY27/Travis
1 parentd86880a commitedc7621

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

‎src/embed_tests/pytuple.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,6 @@ namespace Python.EmbeddingTest
66
{
77
publicclassPyTupleTest
88
{
9-
/// <summary>
10-
/// Tests set-up. Being used to skip class on Travis/PY27
11-
/// </summary>
12-
/// <remarks>
13-
/// FIXME: Fails on Travis/PY27: All tests below (unless otherwise stated)
14-
/// Fatal Python error: auto-releasing thread-state, but no thread-state for this thread
15-
/// Stacktrace:
16-
/// at (wrapper managed-to-native) Python.Runtime.Runtime.PyGILState_Release (intptr)
17-
/// at Python.Runtime.PythonEngine.ReleaseLock (intptr)
18-
/// at Python.Runtime.PythonException.Dispose ()
19-
/// at Python.Runtime.PythonException.Finalize ()
20-
/// at (wrapper runtime-invoke) object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
21-
/// </remarks>
22-
[SetUp]
23-
publicvoidSetUp()
24-
{
25-
if(Environment.GetEnvironmentVariable("TRAVIS")=="true"&&
26-
Environment.GetEnvironmentVariable("TRAVIS_PYTHON_VERSION")=="2.7")
27-
{
28-
Assert.Ignore("Fails on Travis/PY27: Fatal Python error: auto-releasing thread-state, but no thread-state for this thread");
29-
}
30-
}
31-
329
/// <summary>
3310
/// Test IsTupleType without having to Initialize a tuple.
3411
/// PyTuple constructor use IsTupleType. This decouples the tests.

‎src/runtime/pythonexception.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public void Dispose()
140140
{
141141
if(!disposed)
142142
{
143-
if(Runtime.Py_IsInitialized()>0)
143+
if(Runtime.Py_IsInitialized()>0&&!Runtime.IsFinalizing)
144144
{
145145
IntPtrgs=PythonEngine.AcquireLock();
146146
Runtime.XDecref(_pyType);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp