Skip to content

Commit 796854c

Browse files
committed
call runtime.LockOSThread in Initialize
1 parent 51a670d commit 796854c

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

math/math_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package math
22

33
import (
4-
"runtime"
54
"testing"
65

76
gp "github.com/cpunion/go-python"
87
)
98

109
func TestSqrt(t *testing.T) {
11-
runtime.LockOSThread()
1210
// Initialize Python
1311
gp.Initialize()
1412
defer gp.Finalize()

python.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import "C"
88
import (
99
"fmt"
1010
"reflect"
11+
"runtime"
1112
"unsafe"
1213
)
1314

1415
type PyObject = C.PyObject
1516
type PyCFunction = C.PyCFunction
1617

1718
func Initialize() {
19+
runtime.LockOSThread()
1820
C.Py_Initialize()
1921
}
2022

python_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
)
77

88
func setupTest(t *testing.T) {
9-
runtime.LockOSThread()
109
Initialize()
1110
t.Cleanup(func() {
1211
runtime.GC()

0 commit comments

Comments
 (0)