#include <cpython.h>
Public Types | |
using | TYPE_CONVERSION_TUPLE = Tuple< DataType, DelegatePyObject_AsData, DelegatePyObject_FromData<> > |
Static Public Member Functions | |
static MAXON_METHOD Result< PYSTARTOPERATION > | ParseCommandLine (BaseArray< String > *args=nullptr, Data *res=nullptr, PYTHONFLAG *flags=nullptr) |
static MAXON_METHOD Result< void > | GetUrl (DEFAULTRUNTIME pythonPath, Url &pythonLibrary, Url &pythonHome) |
Private Member Functions | |
MAXON_INTERFACE (CPythonLibraryInterface, MAXON_REFERENCE_NORMAL, "net.maxon.python.interface.python.cpythonlibrary") | |
using TYPE_CONVERSION_TUPLE = Tuple<DataType, DelegatePyObject_AsData, DelegatePyObject_FromData<> > |
|
private |
|
static |
MAXON_METHOD Result<void> Init | ( | const Url & | librarypath, |
Bool | createSubLibrary | ||
) |
Initializes a new library object. Must not be called on the pre-allocated Python instances!
[in] | librarypath | Path to the Python library. |
[in] | createSubLibrary | True to create a sub-interpreter. |
MAXON_METHOD Result<void> InitTypes | ( | ) |
Initializes all types after proper initialization. Must not be called on the pre-allocated Python instances!
MAXON_METHOD Result<void> InitBuiltinModules | ( | ) |
Initializes all builtin modules after initialization. Must not be called on the pre-allocated Python instances!
MAXON_METHOD void CPy_Initialize | ( | ) |
Initializes Python. Must not be called on the pre-allocated Python instances!
MAXON_METHOD void CPy_Finalize | ( | ) |
Finalizes Python. Must not be called on the pre-allocated Python instances!
MAXON_METHOD CPyRef CPyModule_Create | ( | const ModuleDefinition & | module | ) |
Initialize a Python module by the information passed in the module definition. GIL must be held.
[in] | module | Information about the builtin module. |
MAXON_METHOD void Free | ( | const Delegate< void()> & | shutdownEngine | ) |
Free all resources and internals of Python. Must not be called on the pre-allocated Python instances!
[in] | shutdownEngine | Delegate which must execute Py_Finalize. GIL got released. |
MAXON_METHOD const PythonDll& GetDll | ( | ) | const |
Meta information of Python library.
MAXON_METHOD FILE_native* FopenNative | ( | const Char * | name, |
const Char * | mode | ||
) |
Should be used whenever the native Python API requires a FILE pointer. Whenever a Python library function takes a FILE pointer it must be guaranteed that a valid FILE object is passed. When Python is for instance compiled with VS2012 and the host application is compiled with VS2013 the FILE object must not be mixed between runtimes (msvcr110.dll != msvcr120.dll). The FILE object must always be from the same runtime. PythonLibrary::FopenNative() and PythonLibrary::fclose() guarantee that always the correct FILE structure is created.
[in] | name | Name object of fopen(name, ...) |
[in] | mode | File mode, like fopen(..., "rb"); |
MAXON_METHOD Error LastPythonCallFailed | ( | MAXON_SOURCE_LOCATION_DECLARATION | , |
Bool | withTraceback, | ||
Bool | restoreError | ||
) |
Returns a Python error with an AggregatedError which is aggreated with PythonTracebackErrors.
[in] | restoreError | True to keep the exception indicator untouched, or False to keep the exception indicator. |
MAXON_METHOD Result<MPyDataRef> RegisterComponentProxy | ( | const CPyRef & | type, |
const Id & | registryId, | ||
const ProxyDefinition & | baseAndInterfaceIds, | ||
const Id & | cid, | ||
Bool | printErrors, | ||
ClassInterface::KIND | kind, | ||
const SourceLocation & | loc, | ||
Bool | createObject, | ||
const DataType & | dtOfObject | ||
) |
Register a proxy component for virtual-, and non-virtual interfaces and adds the object to the Classes registry. Used internally by the Python counterpart of MAXON_COMPONENT_OBJECT_REGISTER and MAXON_COMPONENT_CLASS_REGISTER to register a Python type. GIL must be held.
[in] | type | Python type which represents the implementation. |
[in] | registryId | Optional ID to which registry the object should be published to, can be empty. |
[in] | baseAndInterfaceIds | Definition object with information about the baseclasses and interfaces the type implements. |
[in] | cid | ID of the object, e.g. "net.maxon.iohandler.gzip" |
[in] | printErrors | True if the error of a failed Python function should be printed to the console, otherwise false. If false, all exceptions within the overwritten functions must be handled for exceptions properly. |
[in] | kind | KIND type of the class. |
[in] | loc | Location information where the object got registered from. |
[in] | createObject | True to create and publish a new instance in the registry instead of the class. True for MAXON_COMPONENT_OBJECT_REGISTER, and false for MAXON_COMPONENT_CLASS_REGISTER. |
[in] | dtOfObject | Necessary information of which type the ObjectRef instance is. |
MAXON_METHOD Bool CPy_IsInitialized | ( | ) |
Returns true when Python has been initialized, otherwise False.
MAXON_METHOD const Char* CPy_GetVersion | ( | ) |
Return the version of this Python interpreter. The value is available to Python code as sys.version.
MAXON_METHOD const Char* CPy_GetPlatform | ( | ) |
Return the platform identifier for the current platform. The value is available to Python code as sys.platform.
MAXON_METHOD const Char* CPy_GetCopyright | ( | ) |
Return the official copyright string The value is available to Python code as sys.copyright.
MAXON_METHOD const Char* CPy_GetCompiler | ( | ) |
Return an indication of the compiler used to build the current Python version. The value is available to Python code as part of the variable sys.version.
MAXON_METHOD const Char* CPy_GetBuildInfo | ( | ) |
Return information about the sequence number and build date and time of the current Python interpreter instance. The value is available to Python code as part of the variable sys.version.
MAXON_METHOD Result<void> CPy_SetProgramName | ( | const String & | name | ) |
This function should be called before Py_Initialize() is called for the first time.
[in] | name | Name for the current program. |
MAXON_METHOD Result<void> CPy_SetPythonHome | ( | const Url & | name | ) |
Set the default "home" directory, that is, the location of the standard Python libraries.
[in] | name | Name for the current program. |
MAXON_METHOD String CPy_GetProgramName | ( | ) |
Return the program name set with Py_SetProgramName(), or the default.
MAXON_METHOD String CPy_GetPythonHome | ( | ) |
Return the default "home", that is, the value set by a previous call to Py_SetPythonHome().
MAXON_METHOD Bool ExecuteModule | ( | const String & | name | ) |
Executes a Python module by its name. GIL must be held.
[in] | name | Name of the module. |
MAXON_METHOD MPyCallerContextRef CPyCallerContext_New | ( | ) |
Private. Create caller context object which contains a pointer to this object. The context gets passed to all C-functions as the first self parameter. This is used in PrivateExtractCPythonLibrary{XX} to achieve the convenient wrapping method for C++ functions. GIL must be held.
MAXON_METHOD Bool CPyRun_SimpleFileExFlags | ( | FILE_native * | fp, |
const Char * | filename, | ||
Int32 | closeit, | ||
CPyCompilerFlags * | flags | ||
) |
Executes the Python source code from a file. If 'main' does not already exist, it is created. If the function fails, Checks for CPyErr_Occured and clear the exception indicator of Python accordingly. GIL must be held.
[in] | fp | File pointer where to read the source from. |
[in] | filename | Path of the file. |
[in] | closeit | True if Python should close the pointer using fclose, otherwise false. |
[in] | flags | Optional compiler flags. Can be nullptr. |
MAXON_METHOD Bool CPyRun_SimpleFileExFlags | ( | const Url & | url, |
CPyCompilerFlags * | flags | ||
) |
Executes the Python source code from a file. If 'main' does not already exist, it is created. If the function fails, Checks for CPyErr_Occured and clear the exception indicator of Python accordingly. GIL must be held.
[in] | url | Url where the source is read from. |
[in] | flags | Optional compiler flags. Can be nullptr. |
MAXON_METHOD CPyRef CPyRun_SimpleStringFlags | ( | const String & | code, |
CPyCompilerFlags * | flags | ||
) |
Executes the Python source code from a source string. If the function fails, Checks for CPyErr_Occured and clear the exception indicator of Python accordingly. GIL must be held.
[in] | code | Python source code. |
[in] | flags | Optional compiler flags. Can be nullptr. |
MAXON_METHOD NativePyObject* CPyRun_FileExFlags | ( | FILE_native * | fp, |
const Char * | filename, | ||
Int32 | start, | ||
NativePyObject * | globals, | ||
NativePyObject * | locals, | ||
Int32 | closeit, | ||
CPyCompilerFlags * | flags | ||
) |
Execute Python source code from fp in the context specified by the objects globals and locals with the compiler flags specified by flags. locals must be a dictionary; locals can be any object that implements the mapping protocol. The parameter start specifies the start token that should be used to parse the source code.If the function fails, Checks for CPyErr_Occured and clear the exception indicator of Python accordingly. GIL must be held.
[in] | fp | File pointer where to read the source from. |
[in] | filename | Path of the file. |
[in] | start | Key start like PY_FILE_INPUT |
[in] | globals | Dict object. |
[in] | locals | Any object that implements the mapping protocol. |
[in] | closeit | True if Python should close the pointer using fclose, otherwise false. |
[in] | flags | Optional compiler flags. Can be nullptr. |
MAXON_METHOD Result<void> CPyRun_InteractiveLoopFlags | ( | FILE * | fp, |
const Char * | filename, | ||
CPyCompilerFlags * | flags | ||
) |
Enters the interactive loop of the Python interpreter. If an exception occurrs, it stays in the loop. Only a sys.exit() will exit the function with OK. Raises exceptions only for internal errors. GIL must be held.
[in] | fp | File stream of the input stream, normally stdin. |
[in] | filename | Name of the interactive loop. |
[in] | flags | Optional compiler flags. Can be nullptr. |
MAXON_METHOD PYGILSTATE CPyGilState_Ensure | ( | ) |
Ensure that the current thread is ready to call the Python C API regardless of the current state of Python, or of the global interpreter lock. See https://docs.python.org/3/c-api/init.html#c.PyGILState_Ensure for more information.
MAXON_METHOD void CPyGilState_Release | ( | PYGILSTATE | state | ) |
Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding CPyGILState_Ensure() call. GIL must be held. See https://docs.python.org/3/c-api/init.html#c.PyGILState_Release for more information.
[in] | state | GIL state. |
MAXON_METHOD GILSTATE GetGilState | ( | ) | const |
Returns the current GIL state.
MAXON_METHOD NativePyThreadState* CPyGILState_GetThisThreadState | ( | ) |
Returns the current thread state object.
MAXON_METHOD NativePyThreadState* CPyThreadState_Swap | ( | NativePyThreadState * | state | ) |
Swap the current thread state with the passed one.
state | Thread State to swap with. |
MAXON_METHOD CPyRef CPyThreadState_GetDict | ( | ) |
Get the dictionary of the current thread state.
MAXON_METHOD CPyCodeRef CPy_CompileStringFlags | ( | const Char * | code, |
const Char * | filename, | ||
PYINPUT | start, | ||
CPyCompilerFlags * | flags = nullptr |
||
) |
Parse and compile a given Python source code returning the resulting code object. GIL must be held.
[in] | code | Python source code. |
[in] | filename | Filename of the code object and might appear in the traceback or SyntaxError exception messages. |
[in] | start | Start token. |
[in] | flags | Optional compiler flags. Can be nullptr. |
MAXON_METHOD void CPy_Incref | ( | NativePyObject * | o | ) | const |
Increments the reference count for object o. The object must not be nullptr. GIL must be held. See https://docs.python.org/3/c-api/refcounting.html#c.Py_INCREF for more information.
[in] | o | Object to increment its reference count from. |
MAXON_METHOD void CPy_Decref | ( | NativePyObject * | o | ) | const |
Decrements the reference count for object o. The object must not be nullptr. GIL must be held. See https://docs.python.org/3/c-api/refcounting.html#c.Py_DECREF for more information.
[in] | o | Object to decrement its reference count from. |
MAXON_METHOD void CPy_SafeIncref | ( | NativePyObject * | o | ) | const |
Increments the reference count for object o. If the object is nullptr, the call has no effect. GIL must be held. See https://docs.python.org/3/c-api/refcounting.html#c.Py_XINCREF for more information.
[in] | o | Object to decrement its reference count from. |
MAXON_METHOD void CPy_SafeDecref | ( | NativePyObject * | o | ) | const |
Decrements the reference count for object o. If the object is nullptr, the call has no effect. GIL must be held. See https://docs.python.org/3/c-api/refcounting.html#c.Py_XDECREF for more information.
[in] | o | Object to decrement its reference count from. |
MAXON_FUNCTION void CPy_SafeClear | ( | T *& | o | ) | const |
MAXON_METHOD Int64 CPyGC_Collect | ( | ) |
Runs the garbage collector of Python. GIL must be held.
MAXON_METHOD Int32 CPyCode_Addr2Line | ( | const CPyCodeRef & | codeObject, |
Int32 | x | ||
) |
Returns the line number of a code object with a given instruction.
[in] | codeObject | Code object. |
[in] | x | Instruction in bytes. |
MAXON_METHOD CPyRef UnpackDataType | ( | const CPyRef & | obj | ) |
Returns the internal DataType capsule of a maxon.DataType object. GIL must be held.
[in] | obj | Object of type maxon.DataType. |
MAXON_METHOD CPyRef UnpackData | ( | const CPyRef & | obj | ) |
Returns the internal Data capsule of a maxon.Data object. GIL must be held.
[in] | obj | Object of type maxon.Data. |
MAXON_METHOD CPyConstRef CPy_None | ( | ) | const |
Returns a None object. GIL must be held.
MAXON_METHOD CPyConstRef CPy_True | ( | ) | const |
Returns a False object. GIL must be held.
MAXON_METHOD CPyConstRef CPy_False | ( | ) | const |
Returns a True object. GIL must be held.
MAXON_METHOD CPyConstRef CPy_NotImplemented | ( | ) | const |
Returns the not implemented value object. GIL must be held.
MAXON_METHOD void CPyErr_Print | ( | ) |
Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set (Otherwise it will cause a fatal error!). GIL must be held.
MAXON_METHOD void CPyErr_Clear | ( | ) |
Clears the error indicator of Python. If the error indicator is not set, the call has no effect. GIL must be held.
MAXON_METHOD Bool CPyErr_Occurred | ( | CPyRef * | type = nullptr | ) |
Checks if the error indicator is set. GIL must be held.
[out] | type | Private. Exception type. |
MAXON_METHOD CPyRef CPyErr_SetString | ( | const CPyRef & | errorType, |
const Char * | errorString = nullptr |
||
) |
Sets the error indicator. GIL must be held.
[in] | errorType | Exception type object. |
[in] | errorString | Human readbale exception message. |
MAXON_METHOD CPyRef CPyErr_SetWithErrnoAndFilename | ( | const CPyRef & | errorType, |
Int32 | errorNumber, | ||
const Char * | filename | ||
) |
MAXON_METHOD CPyRef CPyErr_SetWithErrno | ( | const CPyRef & | errorType, |
Int32 | errorNumber | ||
) |
Sets the error indicator. GIL must be held.
[in] | errorType | Exception type object. |
[in] | errorNumber | Error indicator. |
MAXON_METHOD CPyRef CPyErr_SetString | ( | const CPyRef & | errorType, |
const String & | errorString | ||
) |
Sets the error indicator. GIL must be held.
[in] | errorType | Exception type object. |
[in] | errorString | Human readbale exception message. |
MAXON_METHOD void CPyErr_SetNone | ( | const CPyRef & | errorType | ) |
Sets the error indicator without a message. GIL must be held.
[in] | errorType | Exception type object. |
MAXON_METHOD void CPyErr_Fetch | ( | CPyRef & | type, |
CPyRef & | value, | ||
CPyRef & | traceback | ||
) |
Retrieve the error indicator into three variables whose addresses are passed. If the error indicator is not set, all three objects are empty.
[out] | type | Exception type. |
[out] | value | Exception value. |
[out] | traceback | Traceback object. |
MAXON_METHOD void CPyErr_NormalizeException | ( | CPyRef & | type, |
CPyRef & | value, | ||
CPyRef & | traceback | ||
) |
Normalizes the objects, retrieved by CPyErr_Fetched. See https://docs.python.org/3/c-api/exceptions.html#c.PyErr_NormalizeException for more information.
[out] | type | Exception type. |
[out] | value | Exception value. |
[out] | traceback | Traceback object. |
MAXON_METHOD void CPyErr_Restore | ( | const CPyRef & | type, |
const CPyRef & | value, | ||
const CPyRef & | traceback | ||
) |
Restores the exception which got retrieved by CPyErr_Fetch.
[in] | type | Exception type. |
[in] | value | Exception value. |
[in] | traceback | Traceback object. |
MAXON_METHOD Bool CPyErr_ExceptionMatches | ( | const CPyRef & | exc | ) |
Checks if the current set exception is of a given exception.
[in] | exc | A given object. |
MAXON_METHOD Bool CPyExceptionClass_Check | ( | const CPyRef & | o | ) |
Checks if the given object is an exception. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyCapsule_New | ( | void * | pointer, |
const Char * | name, | ||
CPyCapsule_Destructor * | destructor | ||
) | const |
Create a capsule encapsulating a given pointer. The pointer argument may not be nullptr. GIL must be held.
[in] | pointer | Pointer to encapsulate. |
[in] | name | Name of the capsule. |
[in] | destructor | Function pointer which gets called on destruction of the capsule. |
MAXON_METHOD Bool CPyCapsule_SetPointer | ( | const CPyRef & | capsule, |
void * | pointer | ||
) |
Set the pointer of the capsule. GIL must be held.
[in] | capsule | Capsule object. |
[in] | pointer | Set, or overwrite the pointer of the capsule. |
MAXON_METHOD void* CPyCapsule_GetPointer | ( | const CPyRef & | capsule, |
const Char * | name | ||
) |
Retrieve the pointer stored in the capsule. On failure, returns nullptr. GIL must be held.
[in] | capsule | Capsule to extract the pointer from. |
[in] | name | Name of the capsule. On mismatch, the function returns nullptr. |
MAXON_METHOD void* CPyCapsule_GetContext | ( | const CPyRef & | capsule | ) |
Retrieve the context stored in the capsule, which was set by CPyCapsule_SetContext. On failure, returns nullptr. GIL must be held.
[in] | capsule | Capsule to extract the context from. |
MAXON_METHOD Bool CPyCapsule_SetContext | ( | const CPyRef & | capsule, |
void * | context | ||
) |
Set a context pointer to a capsule. GIL must be held.
[in] | capsule | Set, or overwrite the pointer of the capsule. |
MAXON_METHOD Bool CPyCapsule_CheckExact | ( | const CPyRef & | o | ) |
Checks if the given object is a capsule. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD Bool CPyTraceBack_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a traceback. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD Bool CPyClass_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a class. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyTuple_New | ( | UInt | size | ) | const |
Creates a new immutable tuple. The tuple must be initialized right after it got created by using CPyTuple_SetItem. GIL must be held.
[in] | size | Size of the new tuple. |
MAXON_METHOD UInt CPyTuple_Size | ( | const CPyRef & | tuple | ) |
Returns the size of a tuple. GIL must be held. GIL must be held.
MAXON_METHOD CPyRef CPyTuple_GetItem | ( | const CPyRef & | tuple, |
UInt | index | ||
) |
MAXON_METHOD Bool CPyTuple_SetItem | ( | const CPyRef & | tuple, |
UInt | index, | ||
const CPyRef & | item | ||
) |
Sets an item in a tuple at a given index. GIL must be held.
[in] | tuple | Tuple object. |
[in] | index | Index of the element. Raises an IndexError, if index is out of range. |
[in] | item | Item to set. |
MAXON_METHOD CPyRef CPyTuple_GetSlice | ( | const CPyRef & | tuple, |
UInt | from, | ||
UInt | to | ||
) |
Retrieves a slice object from a given slice range. GIL must be held.
[in] | tuple | Tuple object. |
[in] | from | Start index (including the object at this given index). |
[in] | to | End index (excluding the object at this given index). |
MAXON_METHOD Bool CPyTuple_CheckExact | ( | const CPyRef & | tuple | ) |
Checks if a given object is a tuple. GIL must be held.
[in] | tuple | Tuple object. |
MAXON_METHOD Bool CPyObject_HasAttrString | ( | const CPyRef & | o, |
const Char * | attrName | ||
) |
Checks if a given object has a specific attribute name. Equivalent to getattr(o, "name"). GIL must be held.
[in] | o | Object to Checks the attribute for. |
[in] | attrName | Name of the attribute. |
MAXON_METHOD Bool CPyObject_SetAttrString | ( | const CPyRef & | o, |
const Char * | name, | ||
const CPyRef & | item | ||
) |
Sets the value of the attribute named attrName, for object o, to the value item. GIL must be held.
[in] | o | Object which will get the attribute. |
[in] | name | Name of the attribute. |
[in] | item | Value of the attribute. |
MAXON_METHOD CPyRef CPyObject_GetAttrString | ( | const CPyRef & | o, |
const Char * | name | ||
) |
Gets the attribute of an object by an attribute name. GIL must be held.
[in] | o | Object to get the attribute from. |
[in] | name | Name of the attribute. |
MAXON_METHOD CPyRef CPyObject_Call | ( | const CPyRef & | callable_object, |
const CPyRef & | tupleArg, | ||
const CPyRef & | kw | ||
) |
Calls an object with optional argument list or a keyword dictionary. GIL must be held.
[in] | callable_object | Object to call. |
[in] | tupleArg | Argument list. Can be empty. |
[in] | kw | Dictionary list. Can be empty. |
MAXON_METHOD CPyRef CPyObject_Str | ( | const CPyRef & | o | ) |
Computes a string representation of an object. Equivalent to str(o). GIL must be held.
[in] | o | Object to stringify. |
MAXON_METHOD CPyRef CPyObject_Repr | ( | const CPyRef & | o | ) |
Computes a string representation of an object. Equivalent to repr(o). GIL must be held.
[in] | o | Object to stringify. |
MAXON_METHOD CPyRef CPyObject_Dir | ( | const CPyRef & | o | ) |
Gets the internal dictionary of an object. Equivalent to dir(o). GIL must be held.
[in] | o | Object to get the dictionary from.. |
MAXON_METHOD CPyRef CPyObject_RichCompare | ( | const CPyRef & | o1, |
const CPyRef & | o2, | ||
Int32 | opid | ||
) |
Rich compares two objects with each other and returns its result. Equivalent to "o1 op o2". GIL must be held.
[in] | o1 | Left operand. |
[in] | o2 | Right operand. |
MAXON_METHOD Int64 CPyObject_Hash | ( | const CPyRef & | o | ) |
Computes the hash of an object. Equivalent to hash(o). GIL must be held.
[in] | o | Left operand. |
MAXON_METHOD Bool CPyObject_IsTrue | ( | const CPyRef & | o | ) |
Returns true if the object is considered to be true, and false otherwise. This is equivalent to the Python expression 'not not o'. GIL must be held.
[in] | o | Left operand. |
MAXON_METHOD Bool CPyObject_Not | ( | const CPyRef & | o | ) |
Returns false if the object is considered to be true, and true otherwise. This is equivalent to the Python expression 'not o'. GIL must be held.
[in] | o | Left operand. |
MAXON_METHOD Bool CPyCallable_Check | ( | const CPyRef & | o | ) |
Checks if a given object is a callable. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD Int CPyObject_Length | ( | const CPyRef & | o | ) |
Returns the length of an object. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyObject_GetItem | ( | const CPyRef & | o, |
const CPyRef & | key | ||
) |
Gets the item of an object. Equivalent to getitem(o). GIL must be held.
[in] | o | Object. |
[in] | key | Key object. |
MAXON_METHOD CPyRef CPyObject_GetItemInt | ( | const CPyRef & | o, |
Int | index | ||
) |
Gets the item of an object by an index. Equivalent to getitem(o, intValue). GIL must be held.
[in] | o | Object. |
[in] | index | Int key. |
MAXON_METHOD CPyRef CPyObject_GetItemString | ( | const CPyRef & | o, |
const Char * | index | ||
) |
MAXON_METHOD Bool CPyObject_DelItem | ( | const CPyRef & | o, |
const CPyRef & | key | ||
) |
Deletes an item of an object by a given key.
[in] | o | Object. |
[in] | key | Object key. |
MAXON_METHOD Bool CPyObject_SetItem | ( | const CPyRef & | o, |
const CPyRef & | key, | ||
const CPyRef & | item | ||
) |
Sets an item to an object at a given key. Equivalent to o[key]. GIL must be held.
[in] | o | Object. |
[in] | key | String key. |
[in] | item | Object item. |
MAXON_METHOD Bool CPyObject_TypeCheck | ( | const CPyRef & | object, |
const CPyTypeRef & | type | ||
) |
Check if a given object is of a certain type.
[in] | object | Object to check. |
[in] | type | Type object. |
MAXON_METHOD CPyRef CPyObject_CallFunction | ( | const CPyRef & | o | ) |
MAXON_METHOD CPyRef CPySys_GetObject | ( | const Char * | name | ) |
Retrieves an object from the sys module by its name. GIL must be held.
[in] | name | Name of the object. |
MAXON_METHOD Bool CPySys_SetObject | ( | const Char * | name, |
const CPyRef & | o | ||
) |
Sets an object to the sys module. GIL must be held.
[in] | name | Name of the object. |
[in] | o | Object to set. |
MAXON_METHOD Result<void> CPy_SetPath | ( | const BaseArray< Url > & | paths | ) |
Sets an array of paths to sys.path. GIL must be held.
[in] | paths | Array of paths to set. None of the elements must be empty. |
MAXON_METHOD Result<void> CPySys_SetPath | ( | const BaseArray< Url > & | paths, |
PATHHANDLE | add | ||
) |
Sets an array of paths to sys.path. GIL must be held.
[in] | paths | Array of paths to set. None of the elements must be empty. |
[in] | add | Mode of the operation. |
MAXON_METHOD Result<void> CPySys_SetArgvEx | ( | const BaseArray< String > & | args, |
Bool | updatepath | ||
) |
Sets the arguments to sys.argv.
[in] | args | New arguments. |
[in] | updatepath | Bool to update sys.path, otherwise false. |
MAXON_METHOD BaseArray<Url> CPySys_GetPath | ( | ) |
MAXON_METHOD Result<void> CPySite_AddSiteDir | ( | const Url & | siteDir | ) |
Adds a directory to sys.path and process its .pth files.
[in] | siteDir | Directory to add. |
MAXON_METHOD Bool CPyUnicode_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a str or a subtype of StringType. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyUnicode_FromString | ( | const Char * | str | ) | const |
MAXON_METHOD CPyRef CPyUnicode_FromStringAndSize | ( | const Block< const Char > & | block | ) |
Converts a given block to a string object. GIL must be held.
[in] | block | Char block. |
MAXON_METHOD Result<String> CPyUnicode_AsString | ( | const CPyRef & | str | ) |
MAXON_METHOD const Char* CPyUnicode_AsCString | ( | const CPyRef & | str | ) |
Retrieves the pointer to a chary array of a string object. The char array is alive as long as the string object is alive. Until the string object gets deleted, the char array will be deleted too. GIL must be held.
[in] | str | String object. |
MAXON_METHOD Int CPyUnicode_GetLength | ( | const CPyRef & | str | ) |
Gets the size of a string. GIL must be held.
[in] | str | String object. |
MAXON_METHOD CPyRef CPyObject_GetIter | ( | const CPyRef & | o | ) | const |
Gets the iterator of an object. Equivalent to iter(o). GIL must be held.
[in] | o | Object to get the iterator from/ |
MAXON_METHOD CPyRef CPyIter_Next | ( | const CPyRef & | it | ) | const |
Iterate next in an iterator. Equivalent to next(it)
[in] | it | Iterator object. |
MAXON_METHOD CPyRef CPyDict_New | ( | ) | const |
Creates a new empty dictionary. GIL must be held.
MAXON_METHOD CPyRef CPyDict_GetItem | ( | const CPyRef & | dict, |
const CPyRef & | key, | ||
Bool | raiseKeyError | ||
) |
Gets the item of a dictionary. GIL must be held.
[in] | dict | Dict object. |
[in] | key | Key object. |
[in] | raiseKeyError | True to raise a KeyError if the item was not found, otherwise false and only an empty object is returned. |
MAXON_METHOD CPyRef CPyDict_GetItemString | ( | const CPyRef & | dict, |
const Char * | key, | ||
Bool | raiseKeyError | ||
) |
Gets the item of a dictionary by a given key string.
[in] | dict | Dict object. |
[in] | key | Key string. |
[in] | raiseKeyError | True to raise a KeyError if the item was not found, otherwise false and only an empty object is returned. |
MAXON_METHOD Bool CPyDict_SetItem | ( | const CPyRef & | dict, |
const CPyRef & | key, | ||
const CPyRef & | item | ||
) |
Sets an item to a dictionary. GIL must be held.
[in] | dict | Dict object. |
[in] | key | Key object. |
[in] | item | Value item. |
MAXON_METHOD Bool CPyDict_DelItem | ( | const CPyRef & | dict, |
const CPyRef & | key | ||
) |
Deletes an item from a dictionary. GIL must be held.
[in] | dict | Dict object. |
[in] | key | Key object. |
MAXON_METHOD CONTAINS CPyDict_Contains | ( | const CPyRef & | dict, |
const CPyRef & | key | ||
) |
MAXON_METHOD void CPyDict_Clear | ( | const CPyRef & | dict | ) |
Removes all elements from the dictionary. GIL must be held.
[in] | dict | Dict object. |
Goes to the next element in the dictionary, starting from a given index.
[in] | dict | Dict object. |
[in,out] | pos | Index start and gets incremented by one when the function leaves. |
[in] | key | Key object. |
[in] | value | Value object. |
MAXON_METHOD CPyRef CPyDict_Keys | ( | const CPyRef & | dict | ) |
Gets all keys of a dictionary in a list. GIL must be held.
[in] | dict | Dict object. |
MAXON_METHOD CPyRef CPyDict_Values | ( | const CPyRef & | dict | ) |
Gets all values of a dictionary in a list. GIL must be held.
[in] | dict | Dict object. |
MAXON_METHOD CPyRef CPyDict_Items | ( | const CPyRef & | dict | ) |
Gets all items of a dictionary in a list. GIL must be held.
[in] | dict | Dict object. |
MAXON_METHOD Int CPyDict_Size | ( | const CPyRef & | dict | ) |
Return the number of items in the dictionary. This is equivalent to len(p) on a dictionary. GIL must be held.
[in] | dict | Dict object. |
MAXON_METHOD CPyRef CPyDict_Copy | ( | const CPyRef & | dict | ) |
Gets a copy of a given dictionary. Does not make a deepcopy. GIL must be held.
[in] | dict | Dict object. |
MAXON_METHOD Bool CPyDict_SetItemString | ( | const CPyRef & | dict, |
const Char * | key, | ||
const CPyRef & | item | ||
) | const |
Sets an item to a dictionary at a given key.
[in] | dict | Dict object. |
[in] | key | String key. |
[in] | item | Item to set. |
MAXON_METHOD Bool CPyDict_Check | ( | const CPyRef & | o | ) | const |
Checks if the given object is a dict. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyList_New | ( | UInt | size | ) |
Creates a new list of a certain size. GIL must be held.
[in] | size | Size of the list. |
MAXON_METHOD Bool CPyList_CheckExact | ( | const CPyRef & | list | ) |
Checks if a list is a list. No subtype check is performed. GIL must be held.
[in] | list | Object to check. |
MAXON_METHOD Bool CPyList_Clear | ( | const CPyRef & | list | ) |
Clears a list.
[in] | list | The list to clear. |
MAXON_METHOD Int CPyList_Size | ( | const CPyRef & | list | ) |
Evaluates the length of a list and is equivalent to len(list)
.
[in] | list | The list to evaluate. |
MAXON_METHOD CPyRef CPyList_GetItem | ( | const CPyRef & | list, |
UInt | index | ||
) |
MAXON_METHOD Bool CPyList_SetItem | ( | const CPyRef & | list, |
UInt | , | ||
const CPyRef & | item | ||
) |
MAXON_METHOD Bool CPyList_Insert | ( | const CPyRef & | list, |
UInt | , | ||
const CPyRef & | item | ||
) |
MAXON_METHOD Bool CPyList_Append | ( | const CPyRef & | list, |
const CPyRef & | item | ||
) |
MAXON_METHOD CPyRef CPyList_GetSlice | ( | const CPyRef & | list, |
UInt | from, | ||
UInt | to | ||
) |
Returns a slice of a list and is equivalent to list[from, to]
.
[in] | list | The list to return a slice from. |
[in] | from | The starting index of the slice. |
[in] | to | The ending index of the slice. |
Sets a slice of a list and is equivalent to list[from, to] = item
.
[in] | list | The list to set a slice in. |
[in] | from | The starting index of the slice. |
[in] | to | The ending index of the slice. |
[in] | item | The value of the slice, must be a list or NULL. |
MAXON_METHOD Bool CPyList_Sort | ( | const CPyRef & | list | ) |
Sorts a list and is equivalent to list.sort()
.
[in] | list | The list to sort. |
MAXON_METHOD Bool CPyList_Reverse | ( | const CPyRef & | list | ) |
Reverses a list and is equivalent to list.reverse()
.
[in] | list | The list to reverse. |
MAXON_METHOD CPyRef CPyList_AsTuple | ( | const CPyRef & | list | ) |
MAXON_METHOD Bool CPyDict_DelItemString | ( | const CPyRef & | p, |
const Char * | key | ||
) |
Remove the entry in dictionary p which has a key specified by the string key. If key is not in the dictionary, a KeyError is raised.
[in] | p | Dict object. |
[in] | key | Key object. |
MAXON_METHOD Bool CPyModule_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a module. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD Result<Bool> CPyModule_AddObject | ( | const CPyRef & | module, |
const Char * | name, | ||
const CPyRef & | value | ||
) |
Add the given object within the module dictionary with the specified name as key. GIL must be held.
[in] | module | The module object. |
[in] | name | The name of the type (only the last part not the full qualified name). |
[in] | value | The object to be inserted. |
MAXON_METHOD Bool CPyModule_AddType | ( | const CPyRef & | module, |
const CPyTypeRef & | value | ||
) |
Add the given Type Object and make it Ready within the module dictionary. GIL must be held.
[in] | module | The module object. |
[in] | value | The type object to be inserted. |
MAXON_METHOD CPyRef CPyModule_GetDict | ( | const CPyRef & | module | ) |
MAXON_METHOD Bool CPyModule_AddIntConstant | ( | const CPyRef & | mod, |
const Char * | name, | ||
long | value | ||
) |
MAXON_METHOD CPyRef CPyImport_ImportModule | ( | const Char * | name | ) |
import
MAXON_METHOD CPyRef CPyImport_GetImporter | ( | const CPyRef & | path | ) |
MAXON_METHOD CPyRef CPyImport_GetModuleDict | ( | ) |
MAXON_METHOD Bool CPyType_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a type. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD Bool CPyType_IsSubtype | ( | const CPyTypeRef & | a, |
const CPyTypeRef & | b | ||
) |
Checks if a type is really a subclass, subclasscheck() is not called. An object is not a subtype of its own class. Use CPyObject_IsSubtype instead. GIL must be held.
[in] | a | Base type. |
[in] | b | Subtype type. |
MAXON_METHOD Bool CPyType_HasFeature | ( | const CPyTypeRef & | type, |
Int64 | f | ||
) | const |
Checks if a type has a certain feature.
[in] | type | Type object. |
[in] | f | Feature value. |
MAXON_METHOD Bool CPyType_FastSubclass | ( | const CPyTypeRef & | type, |
Int64 | f | ||
) | const |
Performs a quick subtype check.
[in] | type | Type object. |
[in] | f | Subtype value. |
MAXON_METHOD Result<String> CPyType_GetName | ( | const CPyTypeRef & | type | ) |
Returns the name of a given type.
[in] | type | Type object. |
MAXON_METHOD Bool CPyType_Ready | ( | CPyTypeRef & | type | ) |
Initializes a type.
[in] | type | Type object to initialize. |
MAXON_METHOD NativePyThreadState* CPyEval_SaveThread | ( | ) |
Release the global interpreter lock
MAXON_METHOD void CPyEval_RestoreThread | ( | NativePyThreadState * | state | ) |
Restores a given thread state object.
[in] | state | Thread state object. |
MAXON_METHOD Bool CPyEval_ThreadsInitialized | ( | ) |
Checks if multi-threading for Python is enabled.
MAXON_METHOD void CPyEval_InitThreads | ( | ) |
Private. Initializes multi-threading for the Python library. Must not be called on the pre-allocated Python instances!
MAXON_METHOD void CPyEval_AcquireThread | ( | NativePyThreadState * | state | ) |
Acquires the GIL for a thread state object.
[in] | state | Thread state object. |
MAXON_METHOD void CPyEval_ReleaseThread | ( | NativePyThreadState * | state | ) |
Releases the GIL for a thread state object.
[in] | state | Thread state object. |
MAXON_METHOD CPyRef CPyEval_GetBuiltins | ( | ) | const |
Returns the builtins of Python
MAXON_METHOD CPyRef CPyEval_EvalCode | ( | const CPyCodeRef & | code, |
const CPyRef & | globals, | ||
const CPyRef & | locals | ||
) | const |
Executes a given code object in the given globals, and locals dictionary.
[in] | code | Code object to execute. |
[in] | globals | Global scope. |
[in] | locals | Local scope. |
MAXON_METHOD Bool CPyFloat_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a float. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyFloat_FromFloat32 | ( | Float32 | value | ) |
Creates a float object from a Float32.
[in] | value | Float32 value. |
MAXON_METHOD CPyRef CPyFloat_FromFloat64 | ( | Float64 | value | ) |
Creates a float object from a Float64.
[in] | value | Float64 value. |
MAXON_METHOD Float64 CPyFloat_AsFloat64 | ( | const CPyRef & | o | ) |
Converts a float object to Float64.
[in] | o | Object to convert. |
MAXON_FUNCTION T CPyFloat_As | ( | const CPyRef & | o | ) |
Converts an object to a floating type.
T | Floating type. |
[in] | o | Object to convert. |
MAXON_FUNCTION CPyRef CPyFloat_From | ( | std::enable_if_t< STD_IS_REPLACEMENT(same, T, Float32), Float32 > | o | ) |
Converts an object from a Float32 value.
[in] | o | Float value. |
MAXON_FUNCTION CPyRef CPyFloat_From | ( | std::enable_if_t< STD_IS_REPLACEMENT(same, T, Float64), Float64 > | o | ) |
Converts an object from a Float64 value.
[in] | o | Float value. |
MAXON_METHOD Bool CPyLong_Check | ( | const CPyRef & | o | ) |
Checks if the given object is an int or a subtype of PyLong_Type. GIL must be held.
[in] | o | A given object. |
MAXON_METHOD CPyRef CPyBool_FromBool | ( | Bool | value | ) |
Creates a bool object from a Bool.
[in] | value | Bool value. |
MAXON_METHOD CPyRef CPyLong_FromInt16 | ( | Int16 | value | ) |
Creates an int object from a Int16 value.
[in] | value | Int value. |
MAXON_METHOD CPyRef CPyLong_FromUInt16 | ( | UInt16 | value | ) |
Creates an int object from a UInt16 value.
[in] | value | Int value. |
MAXON_METHOD CPyRef CPyLong_FromInt32 | ( | Int32 | value | ) |
Creates an int object from a Int32 value.
[in] | value | Int value. |
MAXON_METHOD CPyRef CPyLong_FromUInt32 | ( | UInt32 | value | ) |
Creates an int object from a UInt32 value.
[in] | value | Int value. |
MAXON_METHOD CPyRef CPyLong_FromInt64 | ( | Int64 | value | ) |
Creates an int object from a Int64 value.
[in] | value | Int value. |
MAXON_METHOD CPyRef CPyLong_FromUInt64 | ( | UInt64 | value | ) |
Creates an int object from a UInt64 value. GIL must be held.
[in] | value | Int value. |
MAXON_METHOD Int16 CPyLong_AsInt16 | ( | const CPyRef & | o | ) |
Converts an object to an Int16 value. GIL must be held.
[in] | o | Object to convert. |
MAXON_METHOD UInt16 CPyLong_AsUInt16 | ( | const CPyRef & | o | ) |
Converts an object to an UInt16 value. GIL must be held.
[in] | o | Object to convert. |
MAXON_METHOD Int32 CPyLong_AsInt32 | ( | const CPyRef & | o | ) |
Converts an object to an Int32 value. GIL must be held.
[in] | o | Object to convert. |
MAXON_METHOD UInt32 CPyLong_AsUInt32 | ( | const CPyRef & | o | ) |
Converts an object to an UInt32 value. GIL must be held.
[in] | o | Object to convert. |
MAXON_METHOD Int64 CPyLong_AsInt64 | ( | const CPyRef & | o | ) |
Converts an object to an Int64 value. GIL must be held.
[in] | o | Object to convert. |
MAXON_METHOD UInt64 CPyLong_AsUInt64 | ( | const CPyRef & | o | ) |
Converts an object to an UInt64 value. GIL must be held.
[in] | o | Object to convert. |
MAXON_FUNCTION T CPyLong_As | ( | const CPyRef & | o | ) |
Converts an object to type T. GIL must be held.
T | Integral type. |
[in] | o | Object to convert. |
MAXON_FUNCTION CPyRef CPyLong_From | ( | std::enable_if_t< std::is_same< T, Int32 >::value, Int32 > | o | ) |
Converts an object from an Int32 value. GIL must be held.
[in] | o | Int value. |
MAXON_FUNCTION CPyRef CPyLong_From | ( | std::enable_if_t< std::is_same< T, Int64 >::value, Int64 > | o | ) |
Converts an object from an Int64 value. GIL must be held.
[in] | o | Int64 value. |
MAXON_METHOD Bool CPyNumber_Check | ( | const CPyRef & | o | ) |
Checks if the given object is a numeric object. GIL must be held.
[in] | o | Object to check. |
MAXON_METHOD MPyFunctionRef MPyFunction_New | ( | const reflection::Function * | func | ) |
Creates a function capsule that encapsulates a reflection::Function pointer.
[in] | func | Function pointer to encapsulate. |
MAXON_METHOD MPyHashMapRef MPyHashMap_New | ( | const HashMap< Data, Data > & | map | ) |
MAXON_METHOD MPyHashMapRef MPyHashMap_New | ( | HashMap< Data, Data > && | map | ) |
MAXON_FUNCTION MPyHashMapRef MPyHashMap_New | ( | HashMap< KEY, VALUE > & | map | ) |
Creates a HashMap capsule that encapsulates a HashMap<Data, Data> pointer.
KEY | Type of the Key. The type should be convertible to a Data. |
VALUE | Type of the Value. The type should be convertible to a Data. |
[in] | map | HashMap<KEY, VALUE> reference to encapsulate. A copy will be done. |
MAXON_METHOD MPyMemberRef MPyMember_New | ( | const reflection::Member * | member | ) |
Creates a member capsule that encapsulates a reflection::Member pointer.
[in] | member | Member pointer to encapsulate. |
MAXON_METHOD Result<void> CPyMem_SetAllocator | ( | CPyMemAllocatorDomain | domain, |
CPyMemAllocatorEx * | allocator | ||
) |
Set a custom memory allocator. See https://docs.python.org/3/c-api/memory.html#c.PyMem_SetAllocator.
MAXON_METHOD MPyClassRef MPyClass_New | ( | const reflection::Class * | cls | ) |
Creates a class capsule that encapsulates a reflection::Member pointer.
[in] | cls | Class pointer to encapsulate. |
MAXON_METHOD Int32* CPy_UTF8Mode | ( | ) |
Returns a mutable pointer to a UTF8Mode. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_DebugFlag | ( | ) |
Returns a mutable pointer to a DebugFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_VerboseFlag | ( | ) |
Returns a mutable pointer to a VerboseFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_QuietFlag | ( | ) |
Returns a mutable pointer to a QuietFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_InteractiveFlag | ( | ) |
Returns a mutable pointer to a InteractiveFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_InspectFlag | ( | ) |
Returns a mutable pointer to a InspectFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_OptimizeFlag | ( | ) |
Returns a mutable pointer to a OptimizeFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_NoSiteFlag | ( | ) |
Returns a mutable pointer to a NoSiteFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_BytesWarningFlag | ( | ) |
Returns a mutable pointer to a BytesWarningFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_FrozenFlag | ( | ) |
Returns a mutable pointer to a FrozenFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_IgnoreEnvironmentFlag | ( | ) |
Returns a mutable pointer to a IgnoreEnvironmentFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_DontWriteBytecodeFlag | ( | ) |
Returns a mutable pointer to a DontWriteBytecodeFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_NoUserSiteDirectory | ( | ) |
Returns a mutable pointer to a NoUserSiteDirectory. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_UnbufferedStdioFlag | ( | ) |
Returns a mutable pointer to a UnbufferedStdioFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD Int32* CPy_IsolatedFlag | ( | ) |
Returns a mutable pointer to a IsolatedFlag. Can be nullptr if the flag is not available in this Python version.
MAXON_METHOD CPyConstRef CPyExc_BaseException | ( | ) |
Returns the BaseException.
MAXON_METHOD CPyConstRef CPyExc_Exception | ( | ) |
Returns the Exception.
MAXON_METHOD CPyConstRef CPyExc_StopIteration | ( | ) |
Returns the StopIteration.
MAXON_METHOD CPyConstRef CPyExc_GeneratorExit | ( | ) |
Returns the GeneratorExit.
MAXON_METHOD CPyConstRef CPyExc_StandardError | ( | ) |
Returns the StandardError.
MAXON_METHOD CPyConstRef CPyExc_ArithmeticError | ( | ) |
Returns the ArithmeticError.
MAXON_METHOD CPyConstRef CPyExc_LookupError | ( | ) |
Returns the LookupError.
MAXON_METHOD CPyConstRef CPyExc_AssertionError | ( | ) |
Returns the AssertionError.
MAXON_METHOD CPyConstRef CPyExc_AttributeError | ( | ) |
Returns the AttributeError.
MAXON_METHOD CPyConstRef CPyExc_EOFError | ( | ) |
Returns the EOFError.
MAXON_METHOD CPyConstRef CPyExc_FloatingPointError | ( | ) |
Returns the FloatingPointError.
MAXON_METHOD CPyConstRef CPyExc_EnvironmentError | ( | ) |
Returns the EnvironmentError.
MAXON_METHOD CPyConstRef CPyExc_IOError | ( | ) |
Returns the IOError.
MAXON_METHOD CPyConstRef CPyExc_OSError | ( | ) |
Returns the OSError.
MAXON_METHOD CPyConstRef CPyExc_ImportError | ( | ) |
Returns the ImportError.
MAXON_METHOD CPyConstRef CPyExc_IndexError | ( | ) |
Returns the IndexError.
MAXON_METHOD CPyConstRef CPyExc_KeyError | ( | ) |
Returns the KeyError.
MAXON_METHOD CPyConstRef CPyExc_KeyboardInterrupt | ( | ) |
Returns the KeyboardInterrupt.
MAXON_METHOD CPyConstRef CPyExc_MemoryError | ( | ) |
Returns the MemoryError.
MAXON_METHOD CPyConstRef CPyExc_NameError | ( | ) |
Returns the NameError.
MAXON_METHOD CPyConstRef CPyExc_OverflowError | ( | ) |
Returns the OverflowError.
MAXON_METHOD CPyConstRef CPyExc_RuntimeError | ( | ) |
Returns the RuntimeError.
MAXON_METHOD CPyConstRef CPyExc_NotImplementedError | ( | ) |
Returns the NotImplementedError.
MAXON_METHOD CPyConstRef CPyExc_SyntaxError | ( | ) |
Returns the SyntaxError.
MAXON_METHOD CPyConstRef CPyExc_IndentationError | ( | ) |
Returns the IndentationError.
MAXON_METHOD CPyConstRef CPyExc_TabError | ( | ) |
Returns the TabError.
MAXON_METHOD CPyConstRef CPyExc_ReferenceError | ( | ) |
Returns the ReferenceError.
MAXON_METHOD CPyConstRef CPyExc_SystemError | ( | ) |
Returns the SystemError.
MAXON_METHOD CPyConstRef CPyExc_SystemExit | ( | ) |
Returns the SystemExit.
MAXON_METHOD CPyConstRef CPyExc_TypeError | ( | ) |
Returns the TypeError.
MAXON_METHOD CPyConstRef CPyExc_UnboundLocalError | ( | ) |
Returns the UnboundLocalError.
MAXON_METHOD CPyConstRef CPyExc_UnicodeError | ( | ) |
Returns the UnicodeError.
MAXON_METHOD CPyConstRef CPyExc_UnicodeEncodeError | ( | ) |
Returns the UnicodeEncodeError.
MAXON_METHOD CPyConstRef CPyExc_UnicodeDecodeError | ( | ) |
Returns the UnicodeDecodeError.
MAXON_METHOD CPyConstRef CPyExc_UnicodeTranslateError | ( | ) |
Returns the UnicodeTranslateError.
MAXON_METHOD CPyConstRef CPyExc_ValueError | ( | ) |
Returns the ValueError.
MAXON_METHOD CPyConstRef CPyExc_ZeroDivisionError | ( | ) |
Returns the ZeroDivisionError.
MAXON_METHOD CPyConstRef CPyExc_WindowsError | ( | ) |
Returns the WindowsError.
MAXON_METHOD CPyConstRef CPyExc_BufferError | ( | ) |
Returns the BufferError.
MAXON_METHOD CPyConstRef CPyExc_MemoryErrorInst | ( | ) |
Returns the MemoryErrorInst.
MAXON_METHOD CPyConstRef CPyExc_Warning | ( | ) |
Returns the Warning.
MAXON_METHOD CPyConstRef CPyExc_UserWarning | ( | ) |
Returns the UserWarning.
MAXON_METHOD CPyConstRef CPyExc_DeprecationWarning | ( | ) |
Returns the DeprecationWarning.
MAXON_METHOD CPyConstRef CPyExc_PendingDeprecationWarning | ( | ) |
Returns the PendingDeprecationWarning.
MAXON_METHOD CPyConstRef CPyExc_SyntaxWarning | ( | ) |
Returns the SyntaxWarning.
MAXON_METHOD CPyConstRef CPyExc_RuntimeWarning | ( | ) |
Returns the RuntimeWarning.
MAXON_METHOD CPyConstRef CPyExc_FutureWarning | ( | ) |
Returns the FutureWarning.
MAXON_METHOD CPyConstRef CPyExc_ImportWarning | ( | ) |
Returns the ImportWarning.
MAXON_METHOD CPyConstRef CPyExc_UnicodeWarning | ( | ) |
Returns the UnicodeWarning.
MAXON_METHOD CPyConstRef CPyExc_BytesWarning | ( | ) |
Returns the BytesWarning.
MAXON_METHOD CPyTypeConstRef CPyNullImporter_Type | ( | ) |
Returns the CPyNullItype of CPyNullImporter.
MAXON_METHOD CPyTypeConstRef CPySuper_Type | ( | ) |
Returns the Ctype of CPySuper.
MAXON_METHOD CPyTypeConstRef CPyBool_Type | ( | ) |
Returns the type of CPyBool.
MAXON_METHOD CPyTypeConstRef CPyObject_Type | ( | ) |
Returns the CPtype of CPyObject.
MAXON_METHOD CPyTypeConstRef CPyModule_Type | ( | ) |
Returns the CPtype of CPyModule.
MAXON_METHOD CPyTypeConstRef CPyUnicode_Type | ( | ) |
Returns the CPtype of CPyUnicode.
MAXON_METHOD CPyTypeConstRef CPyLong_Type | ( | ) |
Returns the type of CPyLong.
MAXON_METHOD CPyTypeConstRef CPyFloat_Type | ( | ) |
Returns the Ctype of CPyFloat.
MAXON_METHOD CPyTypeConstRef CPyTuple_Type | ( | ) |
Returns the Ctype of CPyTuple.
MAXON_METHOD CPyTypeConstRef CPyList_Type | ( | ) |
Returns the type of CPyList.
MAXON_METHOD CPyTypeConstRef CPyDict_Type | ( | ) |
Returns the type of CPyDict.
MAXON_METHOD CPyTypeConstRef CPyClass_Type | ( | ) |
Returns the Ctype of CPyClass.
MAXON_METHOD CPyTypeConstRef CPyTraceBack_Type | ( | ) |
Returns the CPyTrtype of CPyTraceBack.
MAXON_METHOD CPyTypeConstRef CPySlice_Type | ( | ) |
Returns the Ctype of CPySlice.
MAXON_METHOD CPyTypeConstRef CPyType_Type | ( | ) |
Returns the type of CPyType.
MAXON_METHOD CPyTypeConstRef CPyMemoryView_Type | ( | ) |
Returns the CPyMemtype of CPyMemoryView.
MAXON_METHOD const PyChar* ConvertAndCacheString | ( | const String & | str, |
PyStringEncodings | encoding, | ||
UInt * | size = nullptr |
||
) |
Converts a string with a specific encoding and stores the content for the lifetime of the Python interpreters runtime. Some functions in Python need a string that stays alive for the duration of the Pythons interpreter.
[in] | str | String to convert. |
[in] | encoding | Encoding to use. |
MAXON_METHOD Result<void> RegisterSpecificPythonClass | ( | const Id & | typeId, |
const CPyTypeRef & | type | ||
) |
Private.
MAXON_METHOD Result<void> PrivateRegisterBuiltinConverter | ( | const DataType & | dt, |
const DelegatePyObject_AsData & | f1, | ||
const DelegatePyObject_FromData<> & | f2 | ||
) |
MAXON_FUNCTION Result<void> RegisterBuiltinConverter | ( | const DelegatePyObject_AsData & | f1, |
const DelegatePyObject_FromData< T > & | f2 | ||
) |
|
static |
static helper functions
MAXON_METHOD Url GetSpecialPath | ( | SPECIALPATH | ) |
MAXON_METHOD void RegisterSpecialPath | ( | SPECIALPATH | , |
const Url & | path | ||
) |
MAXON_METHOD CPyTypeConstRef MPyDataCapsule_Type | ( | ) |
MAXON_METHOD CPyTypeConstRef CPyData_Type | ( | ) |
MAXON_METHOD CPyTypeConstRef CPyCapsule_Type | ( | ) |
MAXON_METHOD CPyTypeConstRef CPyId_Type | ( | ) |
MAXON_METHOD CPyTypeConstRef CPyInternedId_Type | ( | ) |
MAXON_METHOD CPyRef PrivateGetCurrentCallerContext | ( | ) |
Private.
MAXON_METHOD CPyRef MPyDataType_ToMapperInstance | ( | const CPyRef & | capsule | ) |
MAXON_METHOD CPyRef MPyData_ToMapperInstance | ( | const MPyDataRef & | capsule | ) |
MAXON_METHOD CPyRef CPyObject_ToMapperInstance | ( | const DataType & | dt, |
const CPyRef & | capsule | ||
) |
MAXON_METHOD Result<void> AssociateDataTypeWithPythonTypes | ( | const DataType & | dt, |
const CPyRef & | type | ||
) |
MAXON_METHOD Result<CPyRef> GetAssociatedDataType | ( | const DataType & | dt | ) |
MAXON_METHOD DelegatePyObject_FromData* GetConverterPyObject_FromData | ( | const DataType & | dt | ) |
MAXON_METHOD MPyDataRef MPyData_New | ( | Data & | data | ) |
MAXON_METHOD MPyDataRef MPyData_New | ( | const DataType & | dt, |
Generic * | data, | ||
Bool | owner, | ||
const DataType & | mapDt = DataType::NullValue() |
||
) |
MAXON_METHOD MPyDataTypeRef MPyDataType_New | ( | const DataType & | dt | ) |
MAXON_METHOD Bool MPyDataType_CheckExact | ( | const CPyRef & | o | ) | const |
MAXON_METHOD const DataType& MPyDataType_GetDataType | ( | const MPyDataTypeRef & | o | ) | const |
MAXON_METHOD Bool MPyData_CheckExact | ( | const CPyRef & | o | ) | const |
MAXON_METHOD Result<Data*> CPyObject_AsData | ( | Int | stackDepth, |
const CPyRef & | obj, | ||
const DataType & | expected, | ||
BlockArray< Data > & | k, | ||
BaseArray< reflection::Argument > * | n = nullptr |
||
) |
MAXON_METHOD Result<BaseArray<TYPE_CONVERSION_TUPLE> > GetRegisteredTypesWithConversions | ( | ) |
MAXON_FUNCTION std::enable_if< STD_IS_REPLACEMENT(same, T, DataType), ResultPtr< DataType > >::type ParseArgument | ( | const CPyRef & | args, |
Int32 | argIndex, | ||
Bool | isOptional = false |
||
) |
MAXON_FUNCTION Result< T > ParseRef | ( | const CPyRef & | args, |
Int32 | argIndex, | ||
Bool | isOptional = false |
||
) |
MAXON_FUNCTION std::enable_if< STD_IS_REPLACEMENT(reference, T)||STD_IS_REPLACEMENT(pointer, T), Result< T > >::type ParseArgument | ( | const CPyRef & | args, |
BlockArray< Data > & | tempStack, | ||
Int32 | argIndex, | ||
Bool | isOptional = false |
||
) |
MAXON_FUNCTION std::enable_if<!STD_IS_REPLACEMENT(reference, T) && !STD_IS_REPLACEMENT(pointer, T), Result<T> >::type ParseArgument | ( | const CPyRef & | args, |
BlockArray< Data > & | tempStack, | ||
Int32 | argIndex, | ||
Bool | isOptional = false |
||
) |
if T is not NativePyObject*
MAXON_METHOD Result<DataType> ParseDataType | ( | const CPyRef & | args, |
Int32 | argIndex, | ||
Bool | canBeNone = false |
||
) |
MAXON_FUNCTION Result< T > ParseGeneric | ( | const CPythonLibraryRef & | pylib, |
const CPyRef & | args, | ||
Int32 | argIndex, | ||
DataType & | dt, | ||
Bool | unpackData | ||
) |
MAXON_METHOD void SetError | ( | const Error & | err | ) |
MAXON_METHOD void SetError | ( | const ErrorPtr & | err | ) |
MAXON_METHOD CPyRef MaxonConvertAuto | ( | const CPyRef & | capsule | ) |
MAXON_METHOD CPyRef CPyObject_FromGeneric | ( | const DataType & | origDt, |
const Generic * | object, | ||
OWNERSHIP | ownership, | ||
const CPyTypeRef * | expected = nullptr , |
||
Int * | count = nullptr |
||
) |
MAXON_METHOD CPyRef CreateGlobalDictionary | ( | ) | const |
Creates a scope dictionary which has all built-in modules preset.
MAXON_METHOD Result<BaseArray<SourceLocation> > GetCurrentTraceback | ( | ) |
MAXON_FUNCTION CPyRef Enum_ToMapperInstance | ( | T | enumm | ) |
MAXON_METHOD Class<CPyRef> GetCPyRefClass | ( | ) | const |
Same As CPyReference3 but preferred.
MAXON_METHOD Class<CPyTypeRef> GetCPyTypeRefClass | ( | ) | const |
MAXON_METHOD Class<CPyFrameRef> GetCPyFrameRefClass | ( | ) | const |
MAXON_METHOD Class<CPyTracebackRef> GetCPyTracebackRefClass | ( | ) | const |
MAXON_METHOD Class<CPyCodeRef> GetCPyCodeRefClass | ( | ) | const |
MAXON_METHOD Class<MPyClassRef> GetMPyClassRefClass | ( | ) | const |
MAXON_METHOD Class<MPyMemberRef> GetMPyMemberRefClass | ( | ) | const |
MAXON_METHOD Class<MPyFunctionRef> GetMPyFunctionRefClass | ( | ) | const |
MAXON_METHOD Class<MPyHashMapRef> GetMPyHashMapRefClass | ( | ) | const |
MAXON_METHOD Class<MPyDataTypeRef> GetMPyDataTypeRefClass | ( | ) | const |
MAXON_METHOD Class<MPyDataRef> GetMPyDataRefClass | ( | ) | const |
MAXON_METHOD Class<MPyCallerContextRef> GetMPyCallerContextRefClass | ( | ) | const |