forked from go-python/cpy3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsys.go
More file actions
42 lines (34 loc) · 1.15 KB
/
sys.go
File metadata and controls
42 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
Unless explicitly stated otherwise all files in this repository are licensed
under the MIT License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2018 Datadog, Inc.
*/
package python3
/*
#include "Python.h"
*/
import "C"
import (
"unsafe"
)
// PySys_SetPath, PySys_AddWarnOption, PySys_ResetWarnOptions and
// PySys_AddXOption were removed in Python 3.13. The equivalents live
// on PyConfig (module_search_paths, warnoptions, xoptions) and must be
// set before Py_InitializeFromConfig.
//PySys_GetObject : https://docs.python.org/3/c-api/sys.html#c.PySys_GetObject
func PySys_GetObject(name string) *PyObject {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
return togo(C.PySys_GetObject(cname))
}
//PySys_SetObject : https://docs.python.org/3/c-api/sys.html#c.PySys_SetObject
func PySys_SetObject(name string, v *PyObject) int {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
return int(C.PySys_SetObject(cname, toc(v)))
}
//PySys_GetXOptions : https://docs.python.org/3/c-api/sys.html#c.PySys_GetXOptions
func PySys_GetXOptions() *PyObject {
return togo(C.PySys_GetXOptions())
}