Skip to content

Commit 06a50ea

Browse files
committed
Fix segmentation violation
1 parent 52c6d73 commit 06a50ea

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

init_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ package python_test
22

33
import (
44
"os"
5+
"runtime"
56
"testing"
67

78
python3 "go.nhat.io/python/v3"
89
)
910

1011
// TestMain is the entry point for the test suite.
1112
func TestMain(m *testing.M) {
12-
defer python3.Finalize()
13+
runtime.LockOSThread()
1314

14-
os.Exit(m.Run()) // nolint: gocritic
15+
ret := m.Run()
16+
17+
python3.Finalize()
18+
runtime.UnlockOSThread()
19+
20+
os.Exit(ret)
1521
}

0 commit comments

Comments
 (0)