Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
cccfd203f8 |
|
@ -8,7 +8,6 @@ Copyright 2018 Datadog, Inc.
|
|||
package python3
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python-3.9-embed
|
||||
#include "Python.h"
|
||||
#include "macro.h"
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,6 @@ Copyright 2018 Datadog, Inc.
|
|||
package python3
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python-3.9-embed
|
||||
#include "Python.h"
|
||||
#include "macro.h"
|
||||
*/
|
||||
|
|
1
bytes.go
1
bytes.go
|
@ -8,7 +8,6 @@ Copyright 2018 Datadog, Inc.
|
|||
package python3
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python-3.9-embed
|
||||
#include "Python.h"
|
||||
#include "macro.h"
|
||||
*/
|
||||
|
|
6
dict.go
6
dict.go
|
@ -137,6 +137,6 @@ func PyDict_Next(p *PyObject, ppos *int, pkey, pvalue **PyObject) bool {
|
|||
}
|
||||
|
||||
//PyDict_ClearFreeList : https://docs.python.org/3/c-api/dict.html#c.PyDict_ClearFreeList
|
||||
//func PyDict_ClearFreeList() int {
|
||||
// return int(C.PyDict_ClearFreeList())
|
||||
//}
|
||||
func PyDict_ClearFreeList() int {
|
||||
return int(C.PyDict_ClearFreeList())
|
||||
}
|
||||
|
|
6
float.go
6
float.go
|
@ -58,6 +58,6 @@ func PyFloat_GetMin() float64 {
|
|||
}
|
||||
|
||||
//PyFloat_ClearFreeList : https://docs.python.org/3/c-api/float.html#c.PyFloat_ClearFreeList
|
||||
//func PyFloat_ClearFreeList() int {
|
||||
// return int(C.PyFloat_ClearFreeList())
|
||||
//}
|
||||
func PyFloat_ClearFreeList() int {
|
||||
return int(C.PyFloat_ClearFreeList())
|
||||
}
|
||||
|
|
13
go.mod
13
go.mod
|
@ -1,13 +0,0 @@
|
|||
module git.stein-ivar.net/steino/cpy3
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/go-python/cpy3 v0.2.0
|
||||
github.com/stretchr/testify v1.2.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
)
|
8
go.sum
8
go.sum
|
@ -1,8 +0,0 @@
|
|||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-python/cpy3 v0.2.0 h1:IQ8v6KOTGSvejROZ8BPCfVW4rSMOKfpVwDi6sKYuu1w=
|
||||
github.com/go-python/cpy3 v0.2.0/go.mod h1:W7F8SGWQv11501PYSj9d+NSv8U0/vWYa+FcMxBu4eqo=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
@ -8,7 +8,7 @@ Copyright 2018 Datadog, Inc.
|
|||
package python3
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python3
|
||||
#cgo pkg-config: python-3.8-embed
|
||||
#include "Python.h"
|
||||
*/
|
||||
import "C"
|
||||
|
|
2
list.go
2
list.go
|
@ -83,8 +83,6 @@ func PyList_AsTuple(list *PyObject) *PyObject {
|
|||
}
|
||||
|
||||
//PyList_ClearFreeList : https://docs.python.org/3/c-api/list.html#c.PyList_ClearFreeList
|
||||
/*
|
||||
func PyList_ClearFreeList() int {
|
||||
return int(C.PyList_ClearFreeList())
|
||||
}
|
||||
*/
|
||||
|
|
1
sys.go
1
sys.go
|
@ -8,7 +8,6 @@ Copyright 2018 Datadog, Inc.
|
|||
package python3
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python-3.9-embed
|
||||
#include "Python.h"
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -19,11 +19,9 @@ type PyThreadState C.PyThreadState
|
|||
type PyGILState C.PyGILState_STATE
|
||||
|
||||
//PyEval_InitThreads : https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
|
||||
/*
|
||||
func PyEval_InitThreads() {
|
||||
C.PyEval_InitThreads()
|
||||
}
|
||||
*/
|
||||
|
||||
//PyEval_ThreadsInitialized : https://docs.python.org/3/c-api/init.html#c.PyEval_ThreadsInitialized
|
||||
func PyEval_ThreadsInitialized() bool {
|
||||
|
@ -50,13 +48,6 @@ func PyThreadState_Swap(tstate *PyThreadState) *PyThreadState {
|
|||
return (*PyThreadState)(C.PyThreadState_Swap((*C.PyThreadState)(tstate)))
|
||||
}
|
||||
|
||||
// PyEval_ReInitThreads : https://docs.python.org/3/c-api/init.html#c.PyEval_ReInitThreads
|
||||
/*
|
||||
func PyEval_ReInitThreads() {
|
||||
C.PyEval_ReInitThreads()
|
||||
}
|
||||
*/
|
||||
|
||||
//PyGILState_Ensure : https://docs.python.org/3/c-api/init.html#c.PyGILState_Ensure
|
||||
func PyGILState_Ensure() PyGILState {
|
||||
return PyGILState(C.PyGILState_Ensure())
|
||||
|
|
|
@ -6,15 +6,6 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestThreadInitialization(t *testing.T) {
|
||||
Py_Initialize()
|
||||
PyEval_InitThreads()
|
||||
|
||||
assert.True(t, PyEval_ThreadsInitialized())
|
||||
|
||||
PyEval_ReInitThreads()
|
||||
}
|
||||
|
||||
func TestGIL(t *testing.T) {
|
||||
Py_Initialize()
|
||||
PyEval_InitThreads()
|
||||
|
|
Loading…
Reference in New Issue