Documentation ¶
Index ¶
- func CFree[T comparable](obj *T)
- func CInt2Bool(obj Cint) bool
- func WString2String(value CPyWideString) string
- type CFILE
- type CPyCompilerFlags
- type CPyConfig
- type CPyObject
- type CPyPreConfig
- type CPySSizeT
- type CPyStatus
- type CPyWideString
- type CPyWideStringList
- type Cchar
- type Cint
- type Clong
- type Cvoid
- type Cwchar
- type PyArtifact
- type PyConfig
- func (config *PyConfig) Clear()
- func (config *PyConfig) InitIsolatedConfig()
- func (config *PyConfig) InitPythonConfig()
- func (config *PyConfig) Read() PyStatus
- func (config *PyConfig) SetArgv(argv []CPyWideString) PyStatus
- func (config *PyConfig) SetBoolean(prop *Cint, val bool) PyStatus
- func (config *PyConfig) SetBytesArgv(argv []string) PyStatus
- func (config *PyConfig) SetBytesString(configStr *CPyWideString, str string) PyStatus
- func (config *PyConfig) SetInteger(prop *Cint, val int) PyStatus
- func (config *PyConfig) SetString(prop *CPyWideString, val CPyWideString) PyStatus
- func (config *PyConfig) SetWideStringList(list *CPyWideStringList, items []CPyWideString) PyStatus
- type PyPreConfig
- type PyStatus
- type Pyg
- func (pygi *Pyg) FinalizeEx() int
- func (pygi *Pyg) GetBuildInfo() string
- func (pygi *Pyg) GetCompiler() string
- func (pygi *Pyg) GetCopyright() string
- func (pygi *Pyg) GetExecPrefix() (string, error)
- func (pygi *Pyg) GetPath() (string, error)
- func (pygi *Pyg) GetPlatform() string
- func (pygi *Pyg) GetPrefix() (string, error)
- func (pygi *Pyg) GetProgramFullPath() (string, error)
- func (pygi *Pyg) GetProgramName() (string, error)
- func (pygi *Pyg) GetPythonHome() (string, error)
- func (pygi *Pyg) GetVersion() string
- func (pygi *Pyg) InitializeFromConfig() PyStatus
- func (pygi *Pyg) IsInitialized() bool
- func (pygi *Pyg) PreInitialize() PyStatus
- func (pygi *Pyg) PreInitializeFromArgs(argv []CPyWideString) PyStatus
- func (pygi *Pyg) PreInitializeFromBytesArgs(argv []string) PyStatus
- func (pygi *Pyg) RunFile(fileName string) (int, error)
- func (pygi *Pyg) RunMain() (int, error)
- func (pygi *Pyg) RunString(str string) (int, error)
- func (pygi *Pyg) SetConfigArgv(argv []string) PyStatus
- func (pygi *Pyg) SetConfigBoolean(prop *Cint, value bool) PyStatus
- func (pygi *Pyg) SetConfigInteger(prop *Cint, value int) PyStatus
- func (pygi *Pyg) SetConfigString(prop *CPyWideString, value string) PyStatus
- func (pygi *Pyg) SetPreConfigBoolean(prop *Cint, value bool) PyStatus
- func (pygi *Pyg) SetPreConfigInteger(prop *Cint, value int) PyStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CFree ¶
func CFree[T comparable](obj *T)
func WString2String ¶
func WString2String(value CPyWideString) string
WString2String
Translate a wide char string into a Go string.
Types ¶
type CPyCompilerFlags ¶
type CPyCompilerFlags = C.PyCompilerFlags
type CPyConfig ¶
type CPyConfig = C.CGO_PyConfig
type CPyPreConfig ¶
type CPyPreConfig = C.CGO_PyPreConfig
type CPySSizeT ¶
type CPySSizeT = C.Py_ssize_t
type CPyWideString ¶
func String2WideString ¶
func String2WideString(value string) CPyWideString
String2WideString
Translate a Go string into a wide char string.
type CPyWideStringList ¶
type CPyWideStringList = C.PyWideStringList
type PyArtifact ¶
type PyArtifact[T comparable] struct { // Internal C object that this artifact points // to/represents. CInstance T // contains filtered or unexported fields }
Representative object of some object from the Python CAPI. Allows for related CPython methods to grouped under an object in Go per the object (or objects) they modify.
type PyConfig ¶
type PyConfig struct { PyArtifact[CPyConfig] CInstance CPyConfig CInstanceMapped bool CPyConfig }
func (*PyConfig) Clear ¶
func (config *PyConfig) Clear()
Release configuration memory. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_Clear
func (*PyConfig) InitIsolatedConfig ¶
func (config *PyConfig) InitIsolatedConfig()
Initialize configuration with the isolated configuration. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_InitIsolatedConfig
func (*PyConfig) InitPythonConfig ¶
func (config *PyConfig) InitPythonConfig()
Initialize configuration with the Python configuration. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_InitPythonConfig
func (*PyConfig) Read ¶
Read all Python configuration. Fields which are already initialized are left unchanged. Fields for path configuration are no longer calculated or modified when calling this function, as of Python 3.11.
The PyConfig_Read function only parses `PyConfig.argv` arguments once: `PyConfig.parse_argv` is set to 2 after arguments are parsed. Since Python arguments are stripped from `PyConfig.argv`, parsing arguments twice would parse the application options as Python options. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_Read
func (*PyConfig) SetArgv ¶
func (config *PyConfig) SetArgv(argv []CPyWideString) PyStatus
Set command line arguments. (argv member of config) from the argv list of wide character strings https://docs.python.org/3/c-api/init_config.html#c.PyConfig_SetArgv
func (*PyConfig) SetBoolean ¶
Set property as boolean.
func (*PyConfig) SetBytesArgv ¶
Set command line arguments (argv member of config) from the argv list of bytes strings. Decode bytes using Py_DecodeLocale(). https://docs.python.org/3/c-api/init_config.html#c.PyConfig_SetBytesArgv
func (*PyConfig) SetBytesString ¶
func (config *PyConfig) SetBytesString( configStr *CPyWideString, str string) PyStatus
Decode str using Py_DecodeLocale() and set the result into configStr. Preinitialize Python if needed. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_SetBytesString
func (*PyConfig) SetInteger ¶
Set property as integer.
func (*PyConfig) SetString ¶
func (config *PyConfig) SetString( prop *CPyWideString, val CPyWideString) PyStatus
Copy wide character string into configStr. Preinitialize Python if needed. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_SetString
func (*PyConfig) SetWideStringList ¶
func (config *PyConfig) SetWideStringList( list *CPyWideStringList, items []CPyWideString) PyStatus
Set the list of wide strings list to length and items. Preinitialize Python if needed. https://docs.python.org/3/c-api/init_config.html#c.PyConfig_SetWideStringList
type PyPreConfig ¶
type PyPreConfig struct { PyArtifact[CPyPreConfig] CInstance CPyPreConfig CInstanceMapped bool CPyPreConfig }
func (*PyPreConfig) Clear ¶
func (config *PyPreConfig) Clear()
Free any memory associated with preconfig.
func (*PyPreConfig) InitIsolatedConfig ¶
func (config *PyPreConfig) InitIsolatedConfig()
Initialize the preconfiguration with Isolated Configuration. https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig_InitIsolatedConfig
func (*PyPreConfig) InitPythonConfig ¶
func (config *PyPreConfig) InitPythonConfig()
Initialize the preconfiguration with Python Configuration. https://docs.python.org/3/c-api/init_config.html#c.PyPreConfig_InitPythonConfig
func (*PyPreConfig) SetBoolean ¶
func (config *PyPreConfig) SetBoolean(prop *Cint, val bool) PyStatus
Set property as boolean.
func (*PyPreConfig) SetInteger ¶
func (config *PyPreConfig) SetInteger(prop *Cint, val int) PyStatus
Set property as integer.
type PyStatus ¶
type PyStatus PyArtifact[CPyStatus]
func StatusError ¶
Initialize an error PyStatus. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_Error
func StatusExit ¶
Initialize a PyStatus with an exit code. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_Exit
func StatusNoMemory ¶
func StatusNoMemory() PyStatus
Initialize an allocation failure PyStatus. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_NoMemory
func StatusOk ¶
func StatusOk() PyStatus
Initialize a success PyStatus. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_Ok
func (*PyStatus) ErrMessage ¶
The error message. https://docs.python.org/3/c-api/init_config.html#c.PyStatus.err_msg
func (*PyStatus) ExitCode ¶
The exit code. https://docs.python.org/3/c-api/init_config.html#c.PyStatus.exitcode
func (*PyStatus) ExitStatusException ¶
func (status *PyStatus) ExitStatusException()
Display exception message and exit the process.
func (*PyStatus) FuncName ¶
The name of the function which created an error. https://docs.python.org/3/c-api/init_config.html#c.PyStatus.func
func (*PyStatus) IsError ¶
Check if status is an error. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_IsError
func (*PyStatus) IsException ¶
Check if a status is an exception or exit status. Must be handled if the result is true. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_Exception
func (*PyStatus) IsExit ¶
Check if status has an exit code. https://docs.python.org/3/c-api/init_config.html#c.PyStatus_IsExit
type Pyg ¶
type Pyg struct { PreConfig *PyPreConfig Config *PyConfig }
func PygNew ¶
func PygNew(config *PyConfig, preconfig *PyPreConfig) *Pyg
PygNew
Get a new instance of Python interpreter with preset config and preconfig objects.
func PygNewIsolated ¶
func PygNewIsolated() *Pyg
PygNewIsolated
Get a new isolated instance of Python interpreter.
func (*Pyg) FinalizeEx ¶
FinalizeEx
Undo all initializations made by Py_Initialize() and subsequent use of Python/C API functions, and destroy all sub-interpreters (see Py_NewInterpreter() below) that were created and not yet destroyed since the last call to Py_Initialize(). https://docs.python.org/3/c-api/init.html#c.Py_FinalizeEx
func (*Pyg) GetBuildInfo ¶
GetBuildInfo
Return information about the sequence number and build date and time of the current Python interpreter. https://docs.python.org/3/c-api/init.html#c.Py_GetBuildInfo
func (*Pyg) GetCompiler ¶
GetCompiler
Return an indication of the compiler used to build the current Python version. https://docs.python.org/3/c-api/init.html#c.Py_GetCompiler
func (*Pyg) GetCopyright ¶
GetCopyright
Return the official copyright for the current Python version. https://docs.python.org/3/c-api/init.html#c.Py_GetCopyright
func (*Pyg) GetExecPrefix ¶
GetExecPrefix
Return the exec-prefix for installed platform-dependent files. https://docs.python.org/3/c-api/init.html#c.Py_GetExecPrefix
func (*Pyg) GetPath ¶
GetPath
Return the default module search path. https://docs.python.org/3/c-api/init.html#c.Py_GetPath
func (*Pyg) GetPlatform ¶
GetPlatform
Return the platform identifier for the current platform. https://docs.python.org/3/c-api/init.html#c.Py_GetPlatform
func (*Pyg) GetPrefix ¶
GetPrefix
Return the prefix for installed platform-independent files. https://docs.python.org/3/c-api/init.html#c.Py_GetPrefix
func (*Pyg) GetProgramFullPath ¶
GetProgramFullPath
Return the full program name of the Python executable. https://docs.python.org/3/c-api/init.html#c.Py_GetProgramFullPath
func (*Pyg) GetProgramName ¶
GetProgramName
Return the program name set by Python configuration. https://docs.python.org/3/c-api/init.html#c.Py_GetProgramName
func (*Pyg) GetPythonHome ¶
GetPythonHome
Return the default "home", that is, the value set by configuration. https://docs.python.org/3/c-api/init.html#c.Py_GetPythonHome
func (*Pyg) GetVersion ¶
GetVersion
Return the version of this Python interpreter. https://docs.python.org/3/c-api/init.html#c.Py_GetVersion
func (*Pyg) InitializeFromConfig ¶
InitializeFromConfig
Initialize Python from config configuration. https://docs.python.org/3/c-api/init_config.html#c.Py_InitializeFromConfig
func (*Pyg) IsInitialized ¶
IsInitialized
Whether the Python interpreter has been initialized or not. https://docs.python.org/3/c-api/init.html#c.Py_IsInitialized
func (*Pyg) PreInitialize ¶
PreInitialize
Preinitialize Python from preconfig preconfiguration. https://docs.python.org/3/c-api/init_config.html#c.Py_PreInitialize
func (*Pyg) PreInitializeFromArgs ¶
func (pygi *Pyg) PreInitializeFromArgs(argv []CPyWideString) PyStatus
PreInitializeFromArgs
Preinitialize Python from preconfig preconfiguration. Parse argv command line arguments (wide strings) if parse_argv of PyPreConfig is non-zero. https://docs.python.org/3/c-api/init_config.html#c.Py_PreInitializeFromArgs
func (*Pyg) PreInitializeFromBytesArgs ¶
PreInitializeFromBytesArgs
Preinitialize Python from preconfig preconfiguration. Parse argv command line arguments (bytes strings) if parse_argv of PyPreConfig is non-zero. https://docs.python.org/3/c-api/init_config.html#c.Py_PreInitializeFromBytesArgs
func (*Pyg) RunFile ¶
RunFile
This is a simplified interface to PyRun_SimpleFileExFlags() below, leaving closeit set to 0 and flags set to NULL. https://docs.python.org/3/c-api/veryhigh.html?highlight=pyrun_#c.PyRun_SimpleFile
func (*Pyg) RunMain ¶
RunMain
Execute the command (PyConfig.run_command), the script (PyConfig.run_filename) or the module (PyConfig.run_module) specified on the command line or in the configuration. https://docs.python.org/3/c-api/init_config.html#c.Py_RunMain
func (*Pyg) RunString ¶
RunString
This is a simplified interface to PyRun_SimpleStringFlags() below, leaving the PyCompilerFlags* argument set to NULL. https://docs.python.org/3/c-api/veryhigh.html?highlight=pyrun_#c.PyRun_SimpleString
func (*Pyg) SetConfigString ¶
func (pygi *Pyg) SetConfigString(prop *CPyWideString, value string) PyStatus
SetConfigString
Set a string config property.
func (*Pyg) SetPreConfigBoolean ¶
SetPreConfigBoolean
Set an integer preconfig property as a boolean.