CPythonLibraryInterface Class Reference

#include <cpython.h>

Inheritance diagram for CPythonLibraryInterface:

Public Types

using TYPE_CONVERSION_TUPLE = Tuple< DataType, DelegatePyObject_AsData, DelegatePyObject_FromData<> >
 

Public Member Functions

MAXON_METHOD Result< void > Init (const Url &librarypath, Bool createSubLibrary)
 
MAXON_METHOD Result< void > InitTypes ()
 
MAXON_METHOD Result< void > InitBuiltinModules ()
 
MAXON_METHOD void CPy_Initialize ()
 
MAXON_METHOD void CPy_Finalize ()
 
MAXON_METHOD CPyRef CPyModule_Create (const ModuleDefinition &module)
 
MAXON_METHOD void Free (const Delegate< void()> &shutdownEngine)
 
MAXON_METHOD const PythonDllGetDll () const
 
MAXON_METHOD FILE_nativeFopenNative (const Char *name, const Char *mode)
 
MAXON_METHOD Error LastPythonCallFailed (MAXON_SOURCE_LOCATION_DECLARATION, Bool withTraceback, Bool restoreError)
 
MAXON_METHOD Result< MPyDataRefRegisterComponentProxy (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)
 
MAXON_METHOD Bool CPy_IsInitialized ()
 
MAXON_METHOD const CharCPy_GetVersion ()
 
MAXON_METHOD const CharCPy_GetPlatform ()
 
MAXON_METHOD const CharCPy_GetCopyright ()
 
MAXON_METHOD const CharCPy_GetCompiler ()
 
MAXON_METHOD const CharCPy_GetBuildInfo ()
 
MAXON_METHOD Result< void > CPy_SetProgramName (const String &name)
 
MAXON_METHOD Result< void > CPy_SetPythonHome (const Url &name)
 
MAXON_METHOD String CPy_GetProgramName ()
 
MAXON_METHOD String CPy_GetPythonHome ()
 
MAXON_METHOD Bool ExecuteModule (const String &name)
 
MAXON_METHOD MPyCallerContextRef CPyCallerContext_New ()
 
MAXON_METHOD Bool CPyRun_SimpleFileExFlags (FILE_native *fp, const Char *filename, Int32 closeit, CPyCompilerFlags *flags)
 
MAXON_METHOD Bool CPyRun_SimpleFileExFlags (const Url &url, CPyCompilerFlags *flags)
 
MAXON_METHOD CPyRef CPyRun_SimpleStringFlags (const String &code, CPyCompilerFlags *flags)
 
MAXON_METHOD NativePyObjectCPyRun_FileExFlags (FILE_native *fp, const Char *filename, Int32 start, NativePyObject *globals, NativePyObject *locals, Int32 closeit, CPyCompilerFlags *flags)
 
MAXON_METHOD Result< void > CPyRun_InteractiveLoopFlags (FILE *fp, const Char *filename, CPyCompilerFlags *flags)
 
MAXON_METHOD PYGILSTATE CPyGilState_Ensure ()
 
MAXON_METHOD void CPyGilState_Release (PYGILSTATE state)
 
MAXON_METHOD GILSTATE GetGilState () const
 
MAXON_METHOD NativePyThreadStateCPyGILState_GetThisThreadState ()
 
MAXON_METHOD NativePyThreadStateCPyThreadState_Swap (NativePyThreadState *state)
 
MAXON_METHOD CPyRef CPyThreadState_GetDict ()
 
MAXON_METHOD CPyCodeRef CPy_CompileStringFlags (const Char *code, const Char *filename, PYINPUT start, CPyCompilerFlags *flags=nullptr)
 
MAXON_METHOD void CPy_Incref (NativePyObject *o) const
 
MAXON_METHOD void CPy_Decref (NativePyObject *o) const
 
MAXON_METHOD void CPy_SafeIncref (NativePyObject *o) const
 
MAXON_METHOD void CPy_SafeDecref (NativePyObject *o) const
 
template<typename T >
MAXON_FUNCTION void CPy_SafeClear (T *&o) const
 
MAXON_METHOD Int64 CPyGC_Collect ()
 
MAXON_METHOD Int32 CPyCode_Addr2Line (const CPyCodeRef &codeObject, Int32 x)
 
MAXON_METHOD CPyRef UnpackDataType (const CPyRef &obj)
 
MAXON_METHOD CPyRef UnpackData (const CPyRef &obj)
 
MAXON_METHOD CPyConstRef CPy_None () const
 
MAXON_METHOD CPyConstRef CPy_True () const
 
MAXON_METHOD CPyConstRef CPy_False () const
 
MAXON_METHOD CPyConstRef CPy_NotImplemented () const
 
MAXON_METHOD void CPyErr_Print ()
 
MAXON_METHOD void CPyErr_Clear ()
 
MAXON_METHOD Bool CPyErr_Occurred (CPyRef *type=nullptr)
 
MAXON_METHOD CPyRef CPyErr_SetString (const CPyRef &errorType, const Char *errorString=nullptr)
 
MAXON_METHOD CPyRef CPyErr_SetWithErrnoAndFilename (const CPyRef &errorType, Int32 errorNumber, const Char *filename)
 
MAXON_METHOD CPyRef CPyErr_SetWithErrno (const CPyRef &errorType, Int32 errorNumber)
 
MAXON_METHOD CPyRef CPyErr_SetString (const CPyRef &errorType, const String &errorString)
 
MAXON_METHOD void CPyErr_SetNone (const CPyRef &errorType)
 
MAXON_METHOD void CPyErr_Fetch (CPyRef &type, CPyRef &value, CPyRef &traceback)
 
MAXON_METHOD void CPyErr_NormalizeException (CPyRef &type, CPyRef &value, CPyRef &traceback)
 
MAXON_METHOD void CPyErr_Restore (const CPyRef &type, const CPyRef &value, const CPyRef &traceback)
 
MAXON_METHOD Bool CPyErr_ExceptionMatches (const CPyRef &exc)
 
MAXON_METHOD Bool CPyExceptionClass_Check (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyCapsule_New (void *pointer, const Char *name, CPyCapsule_Destructor *destructor) const
 
MAXON_METHOD Bool CPyCapsule_SetPointer (const CPyRef &capsule, void *pointer)
 
MAXON_METHOD void * CPyCapsule_GetPointer (const CPyRef &capsule, const Char *name)
 
MAXON_METHOD void * CPyCapsule_GetContext (const CPyRef &capsule)
 
MAXON_METHOD Bool CPyCapsule_SetContext (const CPyRef &capsule, void *context)
 
MAXON_METHOD Bool CPyCapsule_CheckExact (const CPyRef &o)
 
MAXON_METHOD Bool CPyTraceBack_Check (const CPyRef &o)
 
MAXON_METHOD Bool CPyClass_Check (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyTuple_New (UInt size) const
 
MAXON_METHOD UInt CPyTuple_Size (const CPyRef &tuple)
 
MAXON_METHOD CPyRef CPyTuple_GetItem (const CPyRef &tuple, UInt index)
 
MAXON_METHOD Bool CPyTuple_SetItem (const CPyRef &tuple, UInt index, const CPyRef &item)
 
MAXON_METHOD CPyRef CPyTuple_GetSlice (const CPyRef &tuple, UInt from, UInt to)
 
MAXON_METHOD Bool CPyTuple_CheckExact (const CPyRef &tuple)
 
MAXON_METHOD Bool CPyObject_HasAttrString (const CPyRef &o, const Char *attrName)
 
MAXON_METHOD Bool CPyObject_SetAttrString (const CPyRef &o, const Char *name, const CPyRef &item)
 
MAXON_METHOD CPyRef CPyObject_GetAttrString (const CPyRef &o, const Char *name)
 
MAXON_METHOD CPyRef CPyObject_Call (const CPyRef &callable_object, const CPyRef &tupleArg, const CPyRef &kw)
 
MAXON_METHOD CPyRef CPyObject_Str (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyObject_Repr (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyObject_Dir (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyObject_RichCompare (const CPyRef &o1, const CPyRef &o2, Int32 opid)
 
MAXON_METHOD Int64 CPyObject_Hash (const CPyRef &o)
 
MAXON_METHOD Bool CPyObject_IsTrue (const CPyRef &o)
 
MAXON_METHOD Bool CPyObject_Not (const CPyRef &o)
 
MAXON_METHOD Bool CPyCallable_Check (const CPyRef &o)
 
MAXON_METHOD Int CPyObject_Length (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyObject_GetItem (const CPyRef &o, const CPyRef &key)
 
MAXON_METHOD CPyRef CPyObject_GetItemInt (const CPyRef &o, Int index)
 
MAXON_METHOD CPyRef CPyObject_GetItemString (const CPyRef &o, const Char *index)
 
MAXON_METHOD Bool CPyObject_DelItem (const CPyRef &o, const CPyRef &key)
 
MAXON_METHOD Bool CPyObject_SetItem (const CPyRef &o, const CPyRef &key, const CPyRef &item)
 
MAXON_METHOD Bool CPyObject_TypeCheck (const CPyRef &object, const CPyTypeRef &type)
 
MAXON_METHOD CPyRef CPyObject_CallFunction (const CPyRef &o)
 
MAXON_METHOD CPyRef CPySys_GetObject (const Char *name)
 
MAXON_METHOD Bool CPySys_SetObject (const Char *name, const CPyRef &o)
 
MAXON_METHOD Result< void > CPy_SetPath (const BaseArray< Url > &paths)
 
MAXON_METHOD Result< void > CPySys_SetPath (const BaseArray< Url > &paths, PATHHANDLE add)
 
MAXON_METHOD Result< void > CPySys_SetArgvEx (const BaseArray< String > &args, Bool updatepath)
 
MAXON_METHOD BaseArray< UrlCPySys_GetPath ()
 
MAXON_METHOD Result< void > CPySite_AddSiteDir (const Url &siteDir)
 
MAXON_METHOD Bool CPyUnicode_Check (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyUnicode_FromString (const Char *str) const
 
MAXON_METHOD CPyRef CPyUnicode_FromStringAndSize (const Block< const Char > &block)
 
MAXON_METHOD Result< StringCPyUnicode_AsString (const CPyRef &str)
 
MAXON_METHOD const CharCPyUnicode_AsCString (const CPyRef &str)
 
MAXON_METHOD Int CPyUnicode_GetLength (const CPyRef &str)
 
MAXON_METHOD CPyRef CPyObject_GetIter (const CPyRef &o) const
 
MAXON_METHOD CPyRef CPyIter_Next (const CPyRef &it) const
 
MAXON_METHOD CPyRef CPyDict_New () const
 
MAXON_METHOD CPyRef CPyDict_GetItem (const CPyRef &dict, const CPyRef &key, Bool raiseKeyError)
 
MAXON_METHOD CPyRef CPyDict_GetItemString (const CPyRef &dict, const Char *key, Bool raiseKeyError)
 
MAXON_METHOD Bool CPyDict_SetItem (const CPyRef &dict, const CPyRef &key, const CPyRef &item)
 
MAXON_METHOD Bool CPyDict_DelItem (const CPyRef &dict, const CPyRef &key)
 
MAXON_METHOD CONTAINS CPyDict_Contains (const CPyRef &dict, const CPyRef &key)
 
MAXON_METHOD void CPyDict_Clear (const CPyRef &dict)
 
MAXON_METHOD Bool CPyDict_Next (const CPyRef &dict, Int &pos, CPyRef &key, CPyRef &value)
 
MAXON_METHOD CPyRef CPyDict_Keys (const CPyRef &dict)
 
MAXON_METHOD CPyRef CPyDict_Values (const CPyRef &dict)
 
MAXON_METHOD CPyRef CPyDict_Items (const CPyRef &dict)
 
MAXON_METHOD Int CPyDict_Size (const CPyRef &dict)
 
MAXON_METHOD CPyRef CPyDict_Copy (const CPyRef &dict)
 
MAXON_METHOD Bool CPyDict_SetItemString (const CPyRef &dict, const Char *key, const CPyRef &item) const
 
MAXON_METHOD Bool CPyDict_Check (const CPyRef &o) const
 
MAXON_METHOD CPyRef CPyList_New (UInt size)
 
MAXON_METHOD Bool CPyList_CheckExact (const CPyRef &list)
 
MAXON_METHOD Bool CPyList_Clear (const CPyRef &list)
 
MAXON_METHOD Int CPyList_Size (const CPyRef &list)
 
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)
 
MAXON_METHOD Bool CPyList_SetSlice (const CPyRef &list, UInt from, UInt to, const CPyRef &item)
 
MAXON_METHOD Bool CPyList_Sort (const CPyRef &list)
 
MAXON_METHOD Bool CPyList_Reverse (const CPyRef &list)
 
MAXON_METHOD CPyRef CPyList_AsTuple (const CPyRef &list)
 
MAXON_METHOD Bool CPyDict_DelItemString (const CPyRef &p, const Char *key)
 
MAXON_METHOD Bool CPyModule_Check (const CPyRef &o)
 
MAXON_METHOD Result< BoolCPyModule_AddObject (const CPyRef &module, const Char *name, const CPyRef &value)
 
MAXON_METHOD Bool CPyModule_AddType (const CPyRef &module, const CPyTypeRef &value)
 
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)
 
MAXON_METHOD CPyRef CPyImport_GetImporter (const CPyRef &path)
 
MAXON_METHOD CPyRef CPyImport_GetModuleDict ()
 
MAXON_METHOD Bool CPyType_Check (const CPyRef &o)
 
MAXON_METHOD Bool CPyType_IsSubtype (const CPyTypeRef &a, const CPyTypeRef &b)
 
MAXON_METHOD Bool CPyType_HasFeature (const CPyTypeRef &type, Int64 f) const
 
MAXON_METHOD Bool CPyType_FastSubclass (const CPyTypeRef &type, Int64 f) const
 
MAXON_METHOD Result< StringCPyType_GetName (const CPyTypeRef &type)
 
MAXON_METHOD Bool CPyType_Ready (CPyTypeRef &type)
 
MAXON_METHOD NativePyThreadStateCPyEval_SaveThread ()
 
MAXON_METHOD void CPyEval_RestoreThread (NativePyThreadState *state)
 
MAXON_METHOD Bool CPyEval_ThreadsInitialized ()
 
MAXON_METHOD void CPyEval_InitThreads ()
 
MAXON_METHOD void CPyEval_AcquireThread (NativePyThreadState *state)
 
MAXON_METHOD void CPyEval_ReleaseThread (NativePyThreadState *state)
 
MAXON_METHOD CPyRef CPyEval_GetBuiltins () const
 
MAXON_METHOD CPyRef CPyEval_EvalCode (const CPyCodeRef &code, const CPyRef &globals, const CPyRef &locals) const
 
MAXON_METHOD Bool CPyFloat_Check (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyFloat_FromFloat32 (Float32 value)
 
MAXON_METHOD CPyRef CPyFloat_FromFloat64 (Float64 value)
 
MAXON_METHOD Float64 CPyFloat_AsFloat64 (const CPyRef &o)
 
template<typename T >
MAXON_FUNCTIONCPyFloat_As (const CPyRef &o)
 
template<typename T >
MAXON_FUNCTION CPyRef CPyFloat_From (std::enable_if_t< STD_IS_REPLACEMENT(same, T, Float32), Float32 > o)
 
template<typename T >
MAXON_FUNCTION CPyRef CPyFloat_From (std::enable_if_t< STD_IS_REPLACEMENT(same, T, Float64), Float64 > o)
 
MAXON_METHOD Bool CPyLong_Check (const CPyRef &o)
 
MAXON_METHOD CPyRef CPyBool_FromBool (Bool value)
 
MAXON_METHOD CPyRef CPyLong_FromInt16 (Int16 value)
 
MAXON_METHOD CPyRef CPyLong_FromUInt16 (UInt16 value)
 
MAXON_METHOD CPyRef CPyLong_FromInt32 (Int32 value)
 
MAXON_METHOD CPyRef CPyLong_FromUInt32 (UInt32 value)
 
MAXON_METHOD CPyRef CPyLong_FromInt64 (Int64 value)
 
MAXON_METHOD CPyRef CPyLong_FromUInt64 (UInt64 value)
 
MAXON_METHOD Int16 CPyLong_AsInt16 (const CPyRef &o)
 
MAXON_METHOD UInt16 CPyLong_AsUInt16 (const CPyRef &o)
 
MAXON_METHOD Int32 CPyLong_AsInt32 (const CPyRef &o)
 
MAXON_METHOD UInt32 CPyLong_AsUInt32 (const CPyRef &o)
 
MAXON_METHOD Int64 CPyLong_AsInt64 (const CPyRef &o)
 
MAXON_METHOD UInt64 CPyLong_AsUInt64 (const CPyRef &o)
 
template<typename T >
MAXON_FUNCTIONCPyLong_As (const CPyRef &o)
 
template<typename T >
MAXON_FUNCTION CPyRef CPyLong_From (std::enable_if_t< std::is_same< T, Int32 >::value, Int32 > o)
 
template<typename T >
MAXON_FUNCTION CPyRef CPyLong_From (std::enable_if_t< std::is_same< T, Int64 >::value, Int64 > o)
 
MAXON_METHOD Bool CPyNumber_Check (const CPyRef &o)
 
MAXON_METHOD MPyFunctionRef MPyFunction_New (const reflection::Function *func)
 
MAXON_METHOD MPyHashMapRef MPyHashMap_New (const HashMap< Data, Data > &map)
 
MAXON_METHOD MPyHashMapRef MPyHashMap_New (HashMap< Data, Data > &&map)
 
template<typename KEY , typename VALUE >
MAXON_FUNCTION MPyHashMapRef MPyHashMap_New (HashMap< KEY, VALUE > &map)
 
MAXON_METHOD MPyMemberRef MPyMember_New (const reflection::Member *member)
 
MAXON_METHOD Result< void > CPyMem_SetAllocator (CPyMemAllocatorDomain domain, CPyMemAllocatorEx *allocator)
 
MAXON_METHOD MPyClassRef MPyClass_New (const reflection::Class *cls)
 
MAXON_METHOD Int32CPy_UTF8Mode ()
 
MAXON_METHOD Int32CPy_DebugFlag ()
 
MAXON_METHOD Int32CPy_VerboseFlag ()
 
MAXON_METHOD Int32CPy_QuietFlag ()
 
MAXON_METHOD Int32CPy_InteractiveFlag ()
 
MAXON_METHOD Int32CPy_InspectFlag ()
 
MAXON_METHOD Int32CPy_OptimizeFlag ()
 
MAXON_METHOD Int32CPy_NoSiteFlag ()
 
MAXON_METHOD Int32CPy_BytesWarningFlag ()
 
MAXON_METHOD Int32CPy_FrozenFlag ()
 
MAXON_METHOD Int32CPy_IgnoreEnvironmentFlag ()
 
MAXON_METHOD Int32CPy_DontWriteBytecodeFlag ()
 
MAXON_METHOD Int32CPy_NoUserSiteDirectory ()
 
MAXON_METHOD Int32CPy_UnbufferedStdioFlag ()
 
MAXON_METHOD Int32CPy_IsolatedFlag ()
 
MAXON_METHOD CPyConstRef CPyExc_BaseException ()
 
MAXON_METHOD CPyConstRef CPyExc_Exception ()
 
MAXON_METHOD CPyConstRef CPyExc_StopIteration ()
 
MAXON_METHOD CPyConstRef CPyExc_GeneratorExit ()
 
MAXON_METHOD CPyConstRef CPyExc_StandardError ()
 
MAXON_METHOD CPyConstRef CPyExc_ArithmeticError ()
 
MAXON_METHOD CPyConstRef CPyExc_LookupError ()
 
MAXON_METHOD CPyConstRef CPyExc_AssertionError ()
 
MAXON_METHOD CPyConstRef CPyExc_AttributeError ()
 
MAXON_METHOD CPyConstRef CPyExc_EOFError ()
 
MAXON_METHOD CPyConstRef CPyExc_FloatingPointError ()
 
MAXON_METHOD CPyConstRef CPyExc_EnvironmentError ()
 
MAXON_METHOD CPyConstRef CPyExc_IOError ()
 
MAXON_METHOD CPyConstRef CPyExc_OSError ()
 
MAXON_METHOD CPyConstRef CPyExc_ImportError ()
 
MAXON_METHOD CPyConstRef CPyExc_IndexError ()
 
MAXON_METHOD CPyConstRef CPyExc_KeyError ()
 
MAXON_METHOD CPyConstRef CPyExc_KeyboardInterrupt ()
 
MAXON_METHOD CPyConstRef CPyExc_MemoryError ()
 
MAXON_METHOD CPyConstRef CPyExc_NameError ()
 
MAXON_METHOD CPyConstRef CPyExc_OverflowError ()
 
MAXON_METHOD CPyConstRef CPyExc_RuntimeError ()
 
MAXON_METHOD CPyConstRef CPyExc_NotImplementedError ()
 
MAXON_METHOD CPyConstRef CPyExc_SyntaxError ()
 
MAXON_METHOD CPyConstRef CPyExc_IndentationError ()
 
MAXON_METHOD CPyConstRef CPyExc_TabError ()
 
MAXON_METHOD CPyConstRef CPyExc_ReferenceError ()
 
MAXON_METHOD CPyConstRef CPyExc_SystemError ()
 
MAXON_METHOD CPyConstRef CPyExc_SystemExit ()
 
MAXON_METHOD CPyConstRef CPyExc_TypeError ()
 
MAXON_METHOD CPyConstRef CPyExc_UnboundLocalError ()
 
MAXON_METHOD CPyConstRef CPyExc_UnicodeError ()
 
MAXON_METHOD CPyConstRef CPyExc_UnicodeEncodeError ()
 
MAXON_METHOD CPyConstRef CPyExc_UnicodeDecodeError ()
 
MAXON_METHOD CPyConstRef CPyExc_UnicodeTranslateError ()
 
MAXON_METHOD CPyConstRef CPyExc_ValueError ()
 
MAXON_METHOD CPyConstRef CPyExc_ZeroDivisionError ()
 
MAXON_METHOD CPyConstRef CPyExc_WindowsError ()
 
MAXON_METHOD CPyConstRef CPyExc_BufferError ()
 
MAXON_METHOD CPyConstRef CPyExc_MemoryErrorInst ()
 
MAXON_METHOD CPyConstRef CPyExc_Warning ()
 
MAXON_METHOD CPyConstRef CPyExc_UserWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_DeprecationWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_PendingDeprecationWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_SyntaxWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_RuntimeWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_FutureWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_ImportWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_UnicodeWarning ()
 
MAXON_METHOD CPyConstRef CPyExc_BytesWarning ()
 
MAXON_METHOD CPyTypeConstRef CPyNullImporter_Type ()
 
MAXON_METHOD CPyTypeConstRef CPySuper_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyBool_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyObject_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyModule_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyUnicode_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyLong_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyFloat_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyTuple_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyList_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyDict_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyClass_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyTraceBack_Type ()
 
MAXON_METHOD CPyTypeConstRef CPySlice_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyType_Type ()
 
MAXON_METHOD CPyTypeConstRef CPyMemoryView_Type ()
 
MAXON_METHOD const PyCharConvertAndCacheString (const String &str, PyStringEncodings encoding, UInt *size=nullptr)
 
MAXON_METHOD Result< void > RegisterSpecificPythonClass (const Id &typeId, const CPyTypeRef &type)
 
MAXON_METHOD Result< void > PrivateRegisterBuiltinConverter (const DataType &dt, const DelegatePyObject_AsData &f1, const DelegatePyObject_FromData<> &f2)
 
template<typename T >
MAXON_FUNCTION Result< void > RegisterBuiltinConverter (const DelegatePyObject_AsData &f1, const DelegatePyObject_FromData< T > &f2)
 
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 ()
 
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< CPyRefGetAssociatedDataType (const DataType &dt)
 
MAXON_METHOD DelegatePyObject_FromDataGetConverterPyObject_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 DataTypeMPyDataType_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 ()
 
template<typename T >
MAXON_FUNCTION std::enable_if< STD_IS_REPLACEMENT(same, T, DataType), ResultPtr< DataType > >::type ParseArgument (const CPyRef &args, Int32 argIndex, Bool isOptional=false)
 
template<typename T >
MAXON_FUNCTION Result< T > ParseRef (const CPyRef &args, Int32 argIndex, Bool isOptional=false)
 
template<typename T >
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)
 
template<typename T >
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_METHOD Result< DataTypeParseDataType (const CPyRef &args, Int32 argIndex, Bool canBeNone=false)
 
template<typename T >
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
 
MAXON_METHOD Result< BaseArray< SourceLocation > > GetCurrentTraceback ()
 
template<typename T >
MAXON_FUNCTION CPyRef Enum_ToMapperInstance (T enumm)
 
MAXON_METHOD Class< CPyRefGetCPyRefClass () const
 
MAXON_METHOD Class< CPyTypeRefGetCPyTypeRefClass () const
 
MAXON_METHOD Class< CPyFrameRefGetCPyFrameRefClass () const
 
MAXON_METHOD Class< CPyTracebackRefGetCPyTracebackRefClass () const
 
MAXON_METHOD Class< CPyCodeRefGetCPyCodeRefClass () const
 
MAXON_METHOD Class< MPyClassRefGetMPyClassRefClass () const
 
MAXON_METHOD Class< MPyMemberRefGetMPyMemberRefClass () const
 
MAXON_METHOD Class< MPyFunctionRefGetMPyFunctionRefClass () const
 
MAXON_METHOD Class< MPyHashMapRefGetMPyHashMapRefClass () const
 
MAXON_METHOD Class< MPyDataTypeRefGetMPyDataTypeRefClass () const
 
MAXON_METHOD Class< MPyDataRefGetMPyDataRefClass () const
 
MAXON_METHOD Class< MPyCallerContextRefGetMPyCallerContextRefClass () const
 

Static Public Member Functions

static MAXON_METHOD Result< PYSTARTOPERATIONParseCommandLine (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")
 

Member Typedef Documentation

◆ TYPE_CONVERSION_TUPLE

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( CPythonLibraryInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.python.interface.python.cpythonlibrary"   
)
private

◆ ParseCommandLine()

static MAXON_METHOD Result<PYSTARTOPERATION> ParseCommandLine ( BaseArray< String > *  args = nullptr,
Data res = nullptr,
PYTHONFLAG flags = nullptr 
)
static

◆ Init()

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!

Parameters
[in]librarypathPath to the Python library.
[in]createSubLibraryTrue to create a sub-interpreter.
Returns
OK on success.

◆ InitTypes()

MAXON_METHOD Result<void> InitTypes ( )

Initializes all types after proper initialization. Must not be called on the pre-allocated Python instances!

Returns
OK on success.

◆ InitBuiltinModules()

MAXON_METHOD Result<void> InitBuiltinModules ( )

Initializes all builtin modules after initialization. Must not be called on the pre-allocated Python instances!

Returns
OK on success.

◆ CPy_Initialize()

MAXON_METHOD void CPy_Initialize ( )

Initializes Python. Must not be called on the pre-allocated Python instances!

◆ CPy_Finalize()

MAXON_METHOD void CPy_Finalize ( )

Finalizes Python. Must not be called on the pre-allocated Python instances!

◆ CPyModule_Create()

MAXON_METHOD CPyRef CPyModule_Create ( const ModuleDefinition module)

Initialize a Python module by the information passed in the module definition. GIL must be held.

Parameters
[in]moduleInformation about the builtin module.
Returns
Reference

◆ Free()

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!

Parameters
[in]shutdownEngineDelegate which must execute Py_Finalize. GIL got released.

◆ GetDll()

MAXON_METHOD const PythonDll& GetDll ( ) const

Meta information of Python library.

Returns
Meta information object.

◆ FopenNative()

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.

Parameters
[in]nameName object of fopen(name, ...)
[in]modeFile mode, like fopen(..., "rb");
Returns
File object or nullptr on failure.

◆ LastPythonCallFailed()

MAXON_METHOD Error LastPythonCallFailed ( MAXON_SOURCE_LOCATION_DECLARATION  ,
Bool  withTraceback,
Bool  restoreError 
)

Returns a Python error with an AggregatedError which is aggreated with PythonTracebackErrors.

Parameters
[in]restoreErrorTrue to keep the exception indicator untouched, or False to keep the exception indicator.
Returns
PythonError.

◆ RegisterComponentProxy()

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.

Parameters
[in]typePython type which represents the implementation.
[in]registryIdOptional ID to which registry the object should be published to, can be empty.
[in]baseAndInterfaceIdsDefinition object with information about the baseclasses and interfaces the type implements.
[in]cidID of the object, e.g. "net.maxon.iohandler.gzip"
[in]printErrorsTrue 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]kindKIND type of the class.
[in]locLocation information where the object got registered from.
[in]createObjectTrue 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]dtOfObjectNecessary information of which type the ObjectRef instance is.
Returns
MPyDataRef of the new class object.

◆ CPy_IsInitialized()

MAXON_METHOD Bool CPy_IsInitialized ( )

Returns true when Python has been initialized, otherwise False.

Returns
True or False.

◆ CPy_GetVersion()

MAXON_METHOD const Char* CPy_GetVersion ( )

Return the version of this Python interpreter. The value is available to Python code as sys.version.

Returns
Version string.

◆ CPy_GetPlatform()

MAXON_METHOD const Char* CPy_GetPlatform ( )

Return the platform identifier for the current platform. The value is available to Python code as sys.platform.

Returns
Platform string.

◆ CPy_GetCopyright()

MAXON_METHOD const Char* CPy_GetCopyright ( )

Return the official copyright string The value is available to Python code as sys.copyright.

Returns
Copright string.

◆ CPy_GetCompiler()

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.

Returns
Copright string.

◆ CPy_GetBuildInfo()

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.

Returns
Build info.

◆ CPy_SetProgramName()

MAXON_METHOD Result<void> CPy_SetProgramName ( const String name)

This function should be called before Py_Initialize() is called for the first time.

Parameters
[in]nameName for the current program.

◆ CPy_SetPythonHome()

MAXON_METHOD Result<void> CPy_SetPythonHome ( const Url name)

Set the default "home" directory, that is, the location of the standard Python libraries.

Parameters
[in]nameName for the current program.

◆ CPy_GetProgramName()

MAXON_METHOD String CPy_GetProgramName ( )

Return the program name set with Py_SetProgramName(), or the default.

Returns
Program name.

◆ CPy_GetPythonHome()

MAXON_METHOD String CPy_GetPythonHome ( )

Return the default "home", that is, the value set by a previous call to Py_SetPythonHome().

Returns
Python home.

◆ ExecuteModule()

MAXON_METHOD Bool ExecuteModule ( const String name)

Executes a Python module by its name. GIL must be held.

Parameters
[in]nameName of the module.
Returns
True on success, otherwise false. Exception indicator is cleared before function returns.

◆ CPyCallerContext_New()

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.

Returns
New caller context.

◆ CPyRun_SimpleFileExFlags() [1/2]

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.

Parameters
[in]fpFile pointer where to read the source from.
[in]filenamePath of the file.
[in]closeitTrue if Python should close the pointer using fclose, otherwise false.
[in]flagsOptional compiler flags. Can be nullptr.
Returns
True on success.

◆ CPyRun_SimpleFileExFlags() [2/2]

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.

Parameters
[in]urlUrl where the source is read from.
[in]flagsOptional compiler flags. Can be nullptr.
Returns
True on success.

◆ CPyRun_SimpleStringFlags()

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.

Parameters
[in]codePython source code.
[in]flagsOptional compiler flags. Can be nullptr.
Returns
True on success.

◆ CPyRun_FileExFlags()

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.

Parameters
[in]fpFile pointer where to read the source from.
[in]filenamePath of the file.
[in]startKey start like PY_FILE_INPUT
[in]globalsDict object.
[in]localsAny object that implements the mapping protocol.
[in]closeitTrue if Python should close the pointer using fclose, otherwise false.
[in]flagsOptional compiler flags. Can be nullptr.
Returns
True on success.

◆ CPyRun_InteractiveLoopFlags()

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.

Parameters
[in]fpFile stream of the input stream, normally stdin.
[in]filenameName of the interactive loop.
[in]flagsOptional compiler flags. Can be nullptr.
Returns
OK on success, and sys.exit().

◆ CPyGilState_Ensure()

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.

Returns
GIL state.

◆ CPyGilState_Release()

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.

Parameters
[in]stateGIL state.

◆ GetGilState()

MAXON_METHOD GILSTATE GetGilState ( ) const

Returns the current GIL state.

Returns
Current GIL state.

◆ CPyGILState_GetThisThreadState()

MAXON_METHOD NativePyThreadState* CPyGILState_GetThisThreadState ( )

Returns the current thread state object.

Returns
Thread state object or nullptr if no thread state object is available.

◆ CPyThreadState_Swap()

MAXON_METHOD NativePyThreadState* CPyThreadState_Swap ( NativePyThreadState state)

Swap the current thread state with the passed one.

Parameters
stateThread State to swap with.
Returns
Old thread state.

◆ CPyThreadState_GetDict()

MAXON_METHOD CPyRef CPyThreadState_GetDict ( )

Get the dictionary of the current thread state.

Returns
Dict of the current thread state.

◆ CPy_CompileStringFlags()

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.

Parameters
[in]codePython source code.
[in]filenameFilename of the code object and might appear in the traceback or SyntaxError exception messages.
[in]startStart token.
[in]flagsOptional compiler flags. Can be nullptr.

◆ CPy_Incref()

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.

Parameters
[in]oObject to increment its reference count from.

◆ CPy_Decref()

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.

Parameters
[in]oObject to decrement its reference count from.

◆ CPy_SafeIncref()

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.

Parameters
[in]oObject to decrement its reference count from.

◆ CPy_SafeDecref()

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.

Parameters
[in]oObject to decrement its reference count from.

◆ CPy_SafeClear()

MAXON_FUNCTION void CPy_SafeClear ( T *&  o) const

◆ CPyGC_Collect()

MAXON_METHOD Int64 CPyGC_Collect ( )

Runs the garbage collector of Python. GIL must be held.

Returns
Number of items collected

◆ CPyCode_Addr2Line()

MAXON_METHOD Int32 CPyCode_Addr2Line ( const CPyCodeRef codeObject,
Int32  x 
)

Returns the line number of a code object with a given instruction.

Parameters
[in]codeObjectCode object.
[in]xInstruction in bytes.
Returns
Line number or -1 on failure.

◆ UnpackDataType()

MAXON_METHOD CPyRef UnpackDataType ( const CPyRef obj)

Returns the internal DataType capsule of a maxon.DataType object. GIL must be held.

Parameters
[in]objObject of type maxon.DataType.
Returns
DataType capsule. Can be safely casted to MPyDataType

◆ UnpackData()

MAXON_METHOD CPyRef UnpackData ( const CPyRef obj)

Returns the internal Data capsule of a maxon.Data object. GIL must be held.

Parameters
[in]objObject of type maxon.Data.
Returns
Data capsule. Can be safely casted to MPyData

◆ CPy_None()

MAXON_METHOD CPyConstRef CPy_None ( ) const

Returns a None object. GIL must be held.

Returns
None object.

◆ CPy_True()

MAXON_METHOD CPyConstRef CPy_True ( ) const

Returns a False object. GIL must be held.

Returns
False object.

◆ CPy_False()

MAXON_METHOD CPyConstRef CPy_False ( ) const

Returns a True object. GIL must be held.

Returns
True object.

◆ CPy_NotImplemented()

MAXON_METHOD CPyConstRef CPy_NotImplemented ( ) const

Returns the not implemented value object. GIL must be held.

Returns
NotImplemented (is not the same as NotImplementedError)

◆ CPyErr_Print()

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.

◆ CPyErr_Clear()

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.

◆ CPyErr_Occurred()

MAXON_METHOD Bool CPyErr_Occurred ( CPyRef type = nullptr)

Checks if the error indicator is set. GIL must be held.

Parameters
[out]typePrivate. Exception type.
Returns
True if the error indicator is set, otherwise false.

◆ CPyErr_SetString() [1/2]

MAXON_METHOD CPyRef CPyErr_SetString ( const CPyRef errorType,
const Char errorString = nullptr 
)

Sets the error indicator. GIL must be held.

Parameters
[in]errorTypeException type object.
[in]errorStringHuman readbale exception message.
Returns
Always returns an empty CPyRef object.

◆ CPyErr_SetWithErrnoAndFilename()

MAXON_METHOD CPyRef CPyErr_SetWithErrnoAndFilename ( const CPyRef errorType,
Int32  errorNumber,
const Char filename 
)

Sets the error indicator with a filename and errno. GIL must be held.

Parameters
[in]errorTypeException type object.
[in]errorNumberError indicator.
[in]filenameFilename object.
Returns
Always returns an empty CPyRef object.

◆ CPyErr_SetWithErrno()

MAXON_METHOD CPyRef CPyErr_SetWithErrno ( const CPyRef errorType,
Int32  errorNumber 
)

Sets the error indicator. GIL must be held.

Parameters
[in]errorTypeException type object.
[in]errorNumberError indicator.
Returns
Always returns an empty CPyRef object.

◆ CPyErr_SetString() [2/2]

MAXON_METHOD CPyRef CPyErr_SetString ( const CPyRef errorType,
const String errorString 
)

Sets the error indicator. GIL must be held.

Parameters
[in]errorTypeException type object.
[in]errorStringHuman readbale exception message.
Returns
Always returns an empty CPyRef object.

◆ CPyErr_SetNone()

MAXON_METHOD void CPyErr_SetNone ( const CPyRef errorType)

Sets the error indicator without a message. GIL must be held.

Parameters
[in]errorTypeException type object.

◆ CPyErr_Fetch()

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.

Parameters
[out]typeException type.
[out]valueException value.
[out]tracebackTraceback object.

◆ CPyErr_NormalizeException()

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.

Parameters
[out]typeException type.
[out]valueException value.
[out]tracebackTraceback object.

◆ CPyErr_Restore()

MAXON_METHOD void CPyErr_Restore ( const CPyRef type,
const CPyRef value,
const CPyRef traceback 
)

Restores the exception which got retrieved by CPyErr_Fetch.

Parameters
[in]typeException type.
[in]valueException value.
[in]tracebackTraceback object.

◆ CPyErr_ExceptionMatches()

MAXON_METHOD Bool CPyErr_ExceptionMatches ( const CPyRef exc)

Checks if the current set exception is of a given exception.

Parameters
[in]excA given object.
Returns
True when equal, otherwise false.

◆ CPyExceptionClass_Check()

MAXON_METHOD Bool CPyExceptionClass_Check ( const CPyRef o)

Checks if the given object is an exception. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is an exception.

◆ CPyCapsule_New()

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.

Parameters
[in]pointerPointer to encapsulate.
[in]nameName of the capsule.
[in]destructorFunction pointer which gets called on destruction of the capsule.
Returns
capsule object.

◆ CPyCapsule_SetPointer()

MAXON_METHOD Bool CPyCapsule_SetPointer ( const CPyRef capsule,
void *  pointer 
)

Set the pointer of the capsule. GIL must be held.

Parameters
[in]capsuleCapsule object.
[in]pointerSet, or overwrite the pointer of the capsule.
Returns
True on success.

◆ CPyCapsule_GetPointer()

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.

Parameters
[in]capsuleCapsule to extract the pointer from.
[in]nameName of the capsule. On mismatch, the function returns nullptr.
Returns
Pointer from capsule.

◆ CPyCapsule_GetContext()

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.

Parameters
[in]capsuleCapsule to extract the context from.
Returns
Pointer to the capsule.

◆ CPyCapsule_SetContext()

MAXON_METHOD Bool CPyCapsule_SetContext ( const CPyRef capsule,
void *  context 
)

Set a context pointer to a capsule. GIL must be held.

Parameters
[in]capsuleSet, or overwrite the pointer of the capsule.
Returns
Context pointer.

◆ CPyCapsule_CheckExact()

MAXON_METHOD Bool CPyCapsule_CheckExact ( const CPyRef o)

Checks if the given object is a capsule. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a capsule.

◆ CPyTraceBack_Check()

MAXON_METHOD Bool CPyTraceBack_Check ( const CPyRef o)

Checks if the given object is a traceback. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a traceback.

◆ CPyClass_Check()

MAXON_METHOD Bool CPyClass_Check ( const CPyRef o)

Checks if the given object is a class. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a class.

◆ CPyTuple_New()

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.

Parameters
[in]sizeSize of the new tuple.
Returns
New tuple or empty object if if exception indicator is set.

◆ CPyTuple_Size()

MAXON_METHOD UInt CPyTuple_Size ( const CPyRef tuple)

Returns the size of a tuple. GIL must be held. GIL must be held.

Returns
Size of the tuple, or -1 if exception indicator is set.

◆ CPyTuple_GetItem()

MAXON_METHOD CPyRef CPyTuple_GetItem ( const CPyRef tuple,
UInt  index 
)

Retrieves an item of a tuple by its index. GIL must be held.

Parameters
[in]tupleTuple object.
[in]indexIndex of the element. Raises an IndexError, if index is out of range.
Returns
Element of the item at the given index, or empty object if exception indicator is set.

◆ CPyTuple_SetItem()

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.

Parameters
[in]tupleTuple object.
[in]indexIndex of the element. Raises an IndexError, if index is out of range.
[in]itemItem to set.
Returns
True on success. Returns false if exception indicator is set.

◆ CPyTuple_GetSlice()

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.

Parameters
[in]tupleTuple object.
[in]fromStart index (including the object at this given index).
[in]toEnd index (excluding the object at this given index).
Returns
Slice objector empty object if exception indicator is set.

◆ CPyTuple_CheckExact()

MAXON_METHOD Bool CPyTuple_CheckExact ( const CPyRef tuple)

Checks if a given object is a tuple. GIL must be held.

Parameters
[in]tupleTuple object.
Returns
True if o is a tuple.

◆ CPyObject_HasAttrString()

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.

Parameters
[in]oObject to Checks the attribute for.
[in]attrNameName of the attribute.
Returns
True on match, otherwise False.

◆ CPyObject_SetAttrString()

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.

Parameters
[in]oObject which will get the attribute.
[in]nameName of the attribute.
[in]itemValue of the attribute.
Returns
True on success, otherwise False if the exception indicator is set.

◆ CPyObject_GetAttrString()

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.

Parameters
[in]oObject to get the attribute from.
[in]nameName of the attribute.
Returns
Attribute on success or empty object if attribute could not be found and exception indicator is set.

◆ CPyObject_Call()

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.

Parameters
[in]callable_objectObject to call.
[in]tupleArgArgument list. Can be empty.
[in]kwDictionary list. Can be empty.
Returns
Result or empty object if the call failed and the exception indicator got set.

◆ CPyObject_Str()

MAXON_METHOD CPyRef CPyObject_Str ( const CPyRef o)

Computes a string representation of an object. Equivalent to str(o). GIL must be held.

Parameters
[in]oObject to stringify.
Returns
Result or empty object if the call failed and the exception indicator got set.

◆ CPyObject_Repr()

MAXON_METHOD CPyRef CPyObject_Repr ( const CPyRef o)

Computes a string representation of an object. Equivalent to repr(o). GIL must be held.

Parameters
[in]oObject to stringify.
Returns
Result or empty object if the call failed and the exception indicator got set.

◆ CPyObject_Dir()

MAXON_METHOD CPyRef CPyObject_Dir ( const CPyRef o)

Gets the internal dictionary of an object. Equivalent to dir(o). GIL must be held.

Parameters
[in]oObject to get the dictionary from..
Returns
Result or empty object if the call failed and the exception indicator got set.

◆ CPyObject_RichCompare()

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.

Parameters
[in]o1Left operand.
[in]o2Right operand.
Returns
Result or empty object if the call failed and the exception indicator got set.

◆ CPyObject_Hash()

MAXON_METHOD Int64 CPyObject_Hash ( const CPyRef o)

Computes the hash of an object. Equivalent to hash(o). GIL must be held.

Parameters
[in]oLeft operand.
Returns
The hash or -1 if the exception indicator got set.

◆ CPyObject_IsTrue()

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.

Parameters
[in]oLeft operand.
Returns
True if the object is true, otherwise false.

◆ CPyObject_Not()

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.

Parameters
[in]oLeft operand.
Returns
True if the object is true, otherwise false.

◆ CPyCallable_Check()

MAXON_METHOD Bool CPyCallable_Check ( const CPyRef o)

Checks if a given object is a callable. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is callable.

◆ CPyObject_Length()

MAXON_METHOD Int CPyObject_Length ( const CPyRef o)

Returns the length of an object. GIL must be held.

Parameters
[in]oA given object.
Returns
Length or -1 if the exception indicator is set.

◆ CPyObject_GetItem()

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.

Parameters
[in]oObject.
[in]keyKey object.
Returns
Result object or empty object if the exception indicator got set.

◆ CPyObject_GetItemInt()

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.

Parameters
[in]oObject.
[in]indexInt key.
Returns
Result object or empty object if the exception indicator got set.

◆ CPyObject_GetItemString()

MAXON_METHOD CPyRef CPyObject_GetItemString ( const CPyRef o,
const Char index 
)

Gets the item of an object by a string. Equivalent to getitem(o, strValue). GIL must be held.

Parameters
[in]oObject.
[in]indexString key.
Returns
Result object or empty object if the exception indicator got set.

◆ CPyObject_DelItem()

MAXON_METHOD Bool CPyObject_DelItem ( const CPyRef o,
const CPyRef key 
)

Deletes an item of an object by a given key.

Parameters
[in]oObject.
[in]keyObject key.
Returns
True on success, or false if the exception indicator got set.

◆ CPyObject_SetItem()

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.

Parameters
[in]oObject.
[in]keyString key.
[in]itemObject item.
Returns
True on success, or false if the exception indicator got set.

◆ CPyObject_TypeCheck()

MAXON_METHOD Bool CPyObject_TypeCheck ( const CPyRef object,
const CPyTypeRef type 
)

Check if a given object is of a certain type.

Parameters
[in]objectObject to check.
[in]typeType object.
Returns
True on match, otherwise False.

◆ CPyObject_CallFunction()

MAXON_METHOD CPyRef CPyObject_CallFunction ( const CPyRef o)

Calls an object. Equivalent to o(). GIL must be held.

Parameters
[in]oObject to call.
Returns
Result object or empty object if the exception indicator got set.

◆ CPySys_GetObject()

MAXON_METHOD CPyRef CPySys_GetObject ( const Char name)

Retrieves an object from the sys module by its name. GIL must be held.

Parameters
[in]nameName of the object.
Returns
Result object or empty object if the exception indicator got set.

◆ CPySys_SetObject()

MAXON_METHOD Bool CPySys_SetObject ( const Char name,
const CPyRef o 
)

Sets an object to the sys module. GIL must be held.

Parameters
[in]nameName of the object.
[in]oObject to set.
Returns
True on success, or false if the exception indicator got set.

◆ CPy_SetPath()

MAXON_METHOD Result<void> CPy_SetPath ( const BaseArray< Url > &  paths)

Sets an array of paths to sys.path. GIL must be held.

Parameters
[in]pathsArray of paths to set. None of the elements must be empty.
Returns
OK on success or error, if the exception indicator got set.

◆ CPySys_SetPath()

MAXON_METHOD Result<void> CPySys_SetPath ( const BaseArray< Url > &  paths,
PATHHANDLE  add 
)

Sets an array of paths to sys.path. GIL must be held.

Parameters
[in]pathsArray of paths to set. None of the elements must be empty.
[in]addMode of the operation.
Returns
OK on success or error, if the exception indicator got set.

◆ CPySys_SetArgvEx()

MAXON_METHOD Result<void> CPySys_SetArgvEx ( const BaseArray< String > &  args,
Bool  updatepath 
)

Sets the arguments to sys.argv.

Parameters
[in]argsNew arguments.
[in]updatepathBool to update sys.path, otherwise false.
Returns
OK on success or error, if the exception indicator got set.

◆ CPySys_GetPath()

MAXON_METHOD BaseArray<Url> CPySys_GetPath ( )

Returns an array of URLs which are in sys.path.

Returns
Array of Url objects.

◆ CPySite_AddSiteDir()

MAXON_METHOD Result<void> CPySite_AddSiteDir ( const Url siteDir)

Adds a directory to sys.path and process its .pth files.

Parameters
[in]siteDirDirectory to add.
Returns
OK on success.

◆ CPyUnicode_Check()

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.

Parameters
[in]oA given object.
Returns
True if o is a str.

◆ CPyUnicode_FromString()

MAXON_METHOD CPyRef CPyUnicode_FromString ( const Char str) const

Converts a given string to a string object. GIL must be held.

Parameters
[in]strString constant.
Returns
String object or empty object if the exception indicator got set.

◆ CPyUnicode_FromStringAndSize()

MAXON_METHOD CPyRef CPyUnicode_FromStringAndSize ( const Block< const Char > &  block)

Converts a given block to a string object. GIL must be held.

Parameters
[in]blockChar block.
Returns
String object or empty object if the exception indicator got set.

◆ CPyUnicode_AsString()

MAXON_METHOD Result<String> CPyUnicode_AsString ( const CPyRef str)

Converts a string object to a string. GIL must be held.

Parameters
[in]strString object.
Returns
String or error if the exception indicator got set.

◆ CPyUnicode_AsCString()

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.

Parameters
[in]strString object.
Returns
Pointer to char array, or nullptr if the the exception indicator got set.

◆ CPyUnicode_GetLength()

MAXON_METHOD Int CPyUnicode_GetLength ( const CPyRef str)

Gets the size of a string. GIL must be held.

Parameters
[in]strString object.
Returns
Length or -1 if the exception indicator got set.

◆ CPyObject_GetIter()

MAXON_METHOD CPyRef CPyObject_GetIter ( const CPyRef o) const

Gets the iterator of an object. Equivalent to iter(o). GIL must be held.

Parameters
[in]oObject to get the iterator from/
Returns
Iterator object.

◆ CPyIter_Next()

MAXON_METHOD CPyRef CPyIter_Next ( const CPyRef it) const

Iterate next in an iterator. Equivalent to next(it)

Parameters
[in]itIterator object.
Returns
Next object or empty object if the exception indicator is set. If the last element got reached, StopIteration is set.

◆ CPyDict_New()

MAXON_METHOD CPyRef CPyDict_New ( ) const

Creates a new empty dictionary. GIL must be held.

Returns
Dictionary object.

◆ CPyDict_GetItem()

MAXON_METHOD CPyRef CPyDict_GetItem ( const CPyRef dict,
const CPyRef key,
Bool  raiseKeyError 
)

Gets the item of a dictionary. GIL must be held.

Parameters
[in]dictDict object.
[in]keyKey object.
[in]raiseKeyErrorTrue to raise a KeyError if the item was not found, otherwise false and only an empty object is returned.
Returns
Value of the passed key. Depending on raiseKeyError, an exception is set if the key was found, or not.

◆ CPyDict_GetItemString()

MAXON_METHOD CPyRef CPyDict_GetItemString ( const CPyRef dict,
const Char key,
Bool  raiseKeyError 
)

Gets the item of a dictionary by a given key string.

Parameters
[in]dictDict object.
[in]keyKey string.
[in]raiseKeyErrorTrue to raise a KeyError if the item was not found, otherwise false and only an empty object is returned.
Returns
Value of the passed key. Depending on raiseKeyError, an exception is set if the key was found, or not.

◆ CPyDict_SetItem()

MAXON_METHOD Bool CPyDict_SetItem ( const CPyRef dict,
const CPyRef key,
const CPyRef item 
)

Sets an item to a dictionary. GIL must be held.

Parameters
[in]dictDict object.
[in]keyKey object.
[in]itemValue item.
Returns
True on sucess, or false if the exception indicator got set.

◆ CPyDict_DelItem()

MAXON_METHOD Bool CPyDict_DelItem ( const CPyRef dict,
const CPyRef key 
)

Deletes an item from a dictionary. GIL must be held.

Parameters
[in]dictDict object.
[in]keyKey object.
Returns
True on sucess, or false if the item was not found and the exception indicator got set.

◆ CPyDict_Contains()

MAXON_METHOD CONTAINS CPyDict_Contains ( const CPyRef dict,
const CPyRef key 
)

Determines if dict contains the key p.

Parameters
[in]dictDict object.
[in]keyKey object.
Returns
True on sucess, or false if the item was not found and the exception indicator got set.

◆ CPyDict_Clear()

MAXON_METHOD void CPyDict_Clear ( const CPyRef dict)

Removes all elements from the dictionary. GIL must be held.

Parameters
[in]dictDict object.

◆ CPyDict_Next()

MAXON_METHOD Bool CPyDict_Next ( const CPyRef dict,
Int pos,
CPyRef key,
CPyRef value 
)

Goes to the next element in the dictionary, starting from a given index.

Parameters
[in]dictDict object.
[in,out]posIndex start and gets incremented by one when the function leaves.
[in]keyKey object.
[in]valueValue object.
Returns
True on sucess, or false if the item was not found and the exception indicator got set.

◆ CPyDict_Keys()

MAXON_METHOD CPyRef CPyDict_Keys ( const CPyRef dict)

Gets all keys of a dictionary in a list. GIL must be held.

Parameters
[in]dictDict object.
Returns
List of keys.

◆ CPyDict_Values()

MAXON_METHOD CPyRef CPyDict_Values ( const CPyRef dict)

Gets all values of a dictionary in a list. GIL must be held.

Parameters
[in]dictDict object.
Returns
List of values.

◆ CPyDict_Items()

MAXON_METHOD CPyRef CPyDict_Items ( const CPyRef dict)

Gets all items of a dictionary in a list. GIL must be held.

Parameters
[in]dictDict object.
Returns
List of items.

◆ CPyDict_Size()

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.

Parameters
[in]dictDict object.
Returns
Number of items.

◆ CPyDict_Copy()

MAXON_METHOD CPyRef CPyDict_Copy ( const CPyRef dict)

Gets a copy of a given dictionary. Does not make a deepcopy. GIL must be held.

Parameters
[in]dictDict object.
Returns
Number of items.

◆ CPyDict_SetItemString()

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.

Parameters
[in]dictDict object.
[in]keyString key.
[in]itemItem to set.
Returns
True on sucess, or false if the exception indicator got set.

◆ CPyDict_Check()

MAXON_METHOD Bool CPyDict_Check ( const CPyRef o) const

Checks if the given object is a dict. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a dict.

◆ CPyList_New()

MAXON_METHOD CPyRef CPyList_New ( UInt  size)

Creates a new list of a certain size. GIL must be held.

Parameters
[in]sizeSize of the list.
Returns
New list object.

◆ CPyList_CheckExact()

MAXON_METHOD Bool CPyList_CheckExact ( const CPyRef list)

Checks if a list is a list. No subtype check is performed. GIL must be held.

Parameters
[in]listObject to check.
Returns
True if the object is a list, otherwise false.

◆ CPyList_Clear()

MAXON_METHOD Bool CPyList_Clear ( const CPyRef list)

Clears a list.

Parameters
[in]listThe list to clear.
Returns
True if the list has been cleared successfully, otherwise false.

◆ CPyList_Size()

MAXON_METHOD Int CPyList_Size ( const CPyRef list)

Evaluates the length of a list and is equivalent to len(list).

Parameters
[in]listThe list to evaluate.
Returns
The length of list.

◆ CPyList_GetItem()

MAXON_METHOD CPyRef CPyList_GetItem ( const CPyRef list,
UInt  index 
)

Returns the object at index in a list and is equivalent to list[index]..

Parameters
[in]listThe list to retrieve the object from.
[in]indexThe index of the object to retrieve.
Returns
The object at index in list.

◆ CPyList_SetItem()

MAXON_METHOD Bool CPyList_SetItem ( const CPyRef list,
UInt  ,
const CPyRef item 
)

◆ CPyList_Insert()

MAXON_METHOD Bool CPyList_Insert ( const CPyRef list,
UInt  ,
const CPyRef item 
)

◆ CPyList_Append()

MAXON_METHOD Bool CPyList_Append ( const CPyRef list,
const CPyRef item 
)

Appends an object to a list and is equivalent to list.append(item)..

Parameters
[in,out]listThe list to append item to.
[in]itemThe item to append.
Returns
True if item has been successfully appended, otherwise false.

◆ CPyList_GetSlice()

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].

Parameters
[in]listThe list to return a slice from.
[in]fromThe starting index of the slice.
[in]toThe ending index of the slice.
Returns
The Python slice object.

◆ CPyList_SetSlice()

MAXON_METHOD Bool CPyList_SetSlice ( const CPyRef list,
UInt  from,
UInt  to,
const CPyRef item 
)

Sets a slice of a list and is equivalent to list[from, to] = item.

Parameters
[in]listThe list to set a slice in.
[in]fromThe starting index of the slice.
[in]toThe ending index of the slice.
[in]itemThe value of the slice, must be a list or NULL.
Returns
True if item has been successfully sliced in, otherwise false.

◆ CPyList_Sort()

MAXON_METHOD Bool CPyList_Sort ( const CPyRef list)

Sorts a list and is equivalent to list.sort().

Parameters
[in]listThe list to sort.
Returns
True if list has been successfully sorted, otherwise false.

◆ CPyList_Reverse()

MAXON_METHOD Bool CPyList_Reverse ( const CPyRef list)

Reverses a list and is equivalent to list.reverse().

Parameters
[in]listThe list to reverse.
Returns
True if list has been successfully reversed, otherwise false.

◆ CPyList_AsTuple()

MAXON_METHOD CPyRef CPyList_AsTuple ( const CPyRef list)

Returns a new Python tuple containing the content of list and is equivalent to tuple(list).

Parameters
[in]listThe list to convert.
Returns
The content of list as a Python tuple.

◆ CPyDict_DelItemString()

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.

Parameters
[in]pDict object.
[in]keyKey object.
Returns
True on success, otherwise false.

◆ CPyModule_Check()

MAXON_METHOD Bool CPyModule_Check ( const CPyRef o)

Checks if the given object is a module. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a module.

◆ CPyModule_AddObject()

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.

Note
if a PyTypeObject is passed, then this type should be already ready otherwise IllegalArgumentError will be returned.
Parameters
[in]moduleThe module object.
[in]nameThe name of the type (only the last part not the full qualified name).
[in]valueThe object to be inserted.
Returns
true if value object is correctly added, otherwise false..

◆ CPyModule_AddType()

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.

Note
The name used will be set by the value of CPyType_Name (last qualifier of tp_name).
Parameters
[in]moduleThe module object.
[in]valueThe type object to be inserted.
Returns
true if value object is correctly added, otherwise false..

◆ CPyModule_GetDict()

MAXON_METHOD CPyRef CPyModule_GetDict ( const CPyRef module)

◆ CPyModule_AddIntConstant()

MAXON_METHOD Bool CPyModule_AddIntConstant ( const CPyRef mod,
const Char name,
long  value 
)

◆ CPyImport_ImportModule()

MAXON_METHOD CPyRef CPyImport_ImportModule ( const Char name)

import

◆ CPyImport_GetImporter()

MAXON_METHOD CPyRef CPyImport_GetImporter ( const CPyRef path)

◆ CPyImport_GetModuleDict()

MAXON_METHOD CPyRef CPyImport_GetModuleDict ( )

◆ CPyType_Check()

MAXON_METHOD Bool CPyType_Check ( const CPyRef o)

Checks if the given object is a type. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a type.

◆ CPyType_IsSubtype()

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.

Parameters
[in]aBase type.
[in]bSubtype type.
Returns
Returns true if a is a subtype of b.

◆ CPyType_HasFeature()

MAXON_METHOD Bool CPyType_HasFeature ( const CPyTypeRef type,
Int64  f 
) const

Checks if a type has a certain feature.

Parameters
[in]typeType object.
[in]fFeature value.
Returns
True if the type supports this feature or false if not.

◆ CPyType_FastSubclass()

MAXON_METHOD Bool CPyType_FastSubclass ( const CPyTypeRef type,
Int64  f 
) const

Performs a quick subtype check.

Parameters
[in]typeType object.
[in]fSubtype value.
Returns
True if the type is of the given subtype or false if not.

◆ CPyType_GetName()

MAXON_METHOD Result<String> CPyType_GetName ( const CPyTypeRef type)

Returns the name of a given type.

Parameters
[in]typeType object.
Returns
Name of the type or error if the exception indicator got set.

◆ CPyType_Ready()

MAXON_METHOD Bool CPyType_Ready ( CPyTypeRef type)

Initializes a type.

Parameters
[in]typeType object to initialize.
Returns
True on success.

◆ CPyEval_SaveThread()

MAXON_METHOD NativePyThreadState* CPyEval_SaveThread ( )

Release the global interpreter lock

Returns
Previous state object.

◆ CPyEval_RestoreThread()

MAXON_METHOD void CPyEval_RestoreThread ( NativePyThreadState state)

Restores a given thread state object.

Parameters
[in]stateThread state object.

◆ CPyEval_ThreadsInitialized()

MAXON_METHOD Bool CPyEval_ThreadsInitialized ( )

Checks if multi-threading for Python is enabled.

Returns
True if available.

◆ CPyEval_InitThreads()

MAXON_METHOD void CPyEval_InitThreads ( )

Private. Initializes multi-threading for the Python library. Must not be called on the pre-allocated Python instances!

◆ CPyEval_AcquireThread()

MAXON_METHOD void CPyEval_AcquireThread ( NativePyThreadState state)

Acquires the GIL for a thread state object.

Parameters
[in]stateThread state object.

◆ CPyEval_ReleaseThread()

MAXON_METHOD void CPyEval_ReleaseThread ( NativePyThreadState state)

Releases the GIL for a thread state object.

Parameters
[in]stateThread state object.

◆ CPyEval_GetBuiltins()

MAXON_METHOD CPyRef CPyEval_GetBuiltins ( ) const

Returns the builtins of Python

Returns
Builtins.

◆ CPyEval_EvalCode()

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.

Parameters
[in]codeCode object to execute.
[in]globalsGlobal scope.
[in]localsLocal scope.
Returns
Result object or empty object if the exception indicator got set.

◆ CPyFloat_Check()

MAXON_METHOD Bool CPyFloat_Check ( const CPyRef o)

Checks if the given object is a float. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a float.

◆ CPyFloat_FromFloat32()

MAXON_METHOD CPyRef CPyFloat_FromFloat32 ( Float32  value)

Creates a float object from a Float32.

Parameters
[in]valueFloat32 value.
Returns
bool object.

◆ CPyFloat_FromFloat64()

MAXON_METHOD CPyRef CPyFloat_FromFloat64 ( Float64  value)

Creates a float object from a Float64.

Parameters
[in]valueFloat64 value.
Returns
bool object.

◆ CPyFloat_AsFloat64()

MAXON_METHOD Float64 CPyFloat_AsFloat64 ( const CPyRef o)

Converts a float object to Float64.

Parameters
[in]oObject to convert.
Returns
Result or -1 if the exception indicator got set.

◆ CPyFloat_As()

MAXON_FUNCTION T CPyFloat_As ( const CPyRef o)

Converts an object to a floating type.

Template Parameters
TFloating type.
Parameters
[in]oObject to convert.
Returns
Result value.

◆ CPyFloat_From() [1/2]

MAXON_FUNCTION CPyRef CPyFloat_From ( std::enable_if_t< STD_IS_REPLACEMENT(same, T, Float32), Float32 o)

Converts an object from a Float32 value.

Parameters
[in]oFloat value.
Returns
Float object.

◆ CPyFloat_From() [2/2]

MAXON_FUNCTION CPyRef CPyFloat_From ( std::enable_if_t< STD_IS_REPLACEMENT(same, T, Float64), Float64 o)

Converts an object from a Float64 value.

Parameters
[in]oFloat value.
Returns
Float object.

◆ CPyLong_Check()

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.

Parameters
[in]oA given object.
Returns
True if o is a

◆ CPyBool_FromBool()

MAXON_METHOD CPyRef CPyBool_FromBool ( Bool  value)

Creates a bool object from a Bool.

Parameters
[in]valueBool value.
Returns
bool object.

◆ CPyLong_FromInt16()

MAXON_METHOD CPyRef CPyLong_FromInt16 ( Int16  value)

Creates an int object from a Int16 value.

Parameters
[in]valueInt value.
Returns
Int object.

◆ CPyLong_FromUInt16()

MAXON_METHOD CPyRef CPyLong_FromUInt16 ( UInt16  value)

Creates an int object from a UInt16 value.

Parameters
[in]valueInt value.
Returns
Int object.

◆ CPyLong_FromInt32()

MAXON_METHOD CPyRef CPyLong_FromInt32 ( Int32  value)

Creates an int object from a Int32 value.

Parameters
[in]valueInt value.
Returns
Int object.

◆ CPyLong_FromUInt32()

MAXON_METHOD CPyRef CPyLong_FromUInt32 ( UInt32  value)

Creates an int object from a UInt32 value.

Parameters
[in]valueInt value.
Returns
Int object.

◆ CPyLong_FromInt64()

MAXON_METHOD CPyRef CPyLong_FromInt64 ( Int64  value)

Creates an int object from a Int64 value.

Parameters
[in]valueInt value.
Returns
Int object.

◆ CPyLong_FromUInt64()

MAXON_METHOD CPyRef CPyLong_FromUInt64 ( UInt64  value)

Creates an int object from a UInt64 value. GIL must be held.

Parameters
[in]valueInt value.
Returns
Int object.

◆ CPyLong_AsInt16()

MAXON_METHOD Int16 CPyLong_AsInt16 ( const CPyRef o)

Converts an object to an Int16 value. GIL must be held.

Parameters
[in]oObject to convert.
Returns
Integer value, or -1 if the exception indicator got set.

◆ CPyLong_AsUInt16()

MAXON_METHOD UInt16 CPyLong_AsUInt16 ( const CPyRef o)

Converts an object to an UInt16 value. GIL must be held.

Parameters
[in]oObject to convert.
Returns
Integer value, or -1 if the exception indicator got set.

◆ CPyLong_AsInt32()

MAXON_METHOD Int32 CPyLong_AsInt32 ( const CPyRef o)

Converts an object to an Int32 value. GIL must be held.

Parameters
[in]oObject to convert.
Returns
Integer value, or -1 if the exception indicator got set.

◆ CPyLong_AsUInt32()

MAXON_METHOD UInt32 CPyLong_AsUInt32 ( const CPyRef o)

Converts an object to an UInt32 value. GIL must be held.

Parameters
[in]oObject to convert.
Returns
Integer value, or -1 if the exception indicator got set.

◆ CPyLong_AsInt64()

MAXON_METHOD Int64 CPyLong_AsInt64 ( const CPyRef o)

Converts an object to an Int64 value. GIL must be held.

Parameters
[in]oObject to convert.
Returns
Integer value, or -1 if the exception indicator got set.

◆ CPyLong_AsUInt64()

MAXON_METHOD UInt64 CPyLong_AsUInt64 ( const CPyRef o)

Converts an object to an UInt64 value. GIL must be held.

Parameters
[in]oObject to convert.
Returns
Integer value, or -1 if the exception indicator got set.

◆ CPyLong_As()

MAXON_FUNCTION T CPyLong_As ( const CPyRef o)

Converts an object to type T. GIL must be held.

Template Parameters
TIntegral type.
Parameters
[in]oObject to convert.
Returns
Result value.

◆ CPyLong_From() [1/2]

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.

Parameters
[in]oInt value.
Returns
Int object.

◆ CPyLong_From() [2/2]

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.

Parameters
[in]oInt64 value.
Returns
Int object.

◆ CPyNumber_Check()

MAXON_METHOD Bool CPyNumber_Check ( const CPyRef o)

Checks if the given object is a numeric object. GIL must be held.

Parameters
[in]oObject to check.
Returns
True if an object is a numeric value.

◆ MPyFunction_New()

MAXON_METHOD MPyFunctionRef MPyFunction_New ( const reflection::Function func)

Creates a function capsule that encapsulates a reflection::Function pointer.

Parameters
[in]funcFunction pointer to encapsulate.
Returns
New function capsule or empty object if the exception indicator got set.

◆ MPyHashMap_New() [1/3]

MAXON_METHOD MPyHashMapRef MPyHashMap_New ( const HashMap< Data, Data > &  map)

Creates a HashMap capsule that encapsulates a HashMap<Data, Data> pointer.

Parameters
[in]mapHashMap<Data, Data> reference to encapsulate. A copy will be done.
Returns
New HashMap capsule or empty object if the exception indicator got set.

◆ MPyHashMap_New() [2/3]

MAXON_METHOD MPyHashMapRef MPyHashMap_New ( HashMap< Data, Data > &&  map)

Creates a HashMap capsule that encapsulates a HashMap<Data, Data> pointer.

Parameters
[in]mapHashMap<Data, Data> reference to encapsulate.
Returns
New HashMap capsule or empty object if the exception indicator got set.

◆ MPyHashMap_New() [3/3]

MAXON_FUNCTION MPyHashMapRef MPyHashMap_New ( HashMap< KEY, VALUE > &  map)

Creates a HashMap capsule that encapsulates a HashMap<Data, Data> pointer.

Template Parameters
KEYType of the Key. The type should be convertible to a Data.
VALUEType of the Value. The type should be convertible to a Data.
Parameters
[in]mapHashMap<KEY, VALUE> reference to encapsulate. A copy will be done.
Returns
New HashMap capsule or empty object if the exception indicator got set.

◆ MPyMember_New()

MAXON_METHOD MPyMemberRef MPyMember_New ( const reflection::Member member)

Creates a member capsule that encapsulates a reflection::Member pointer.

Parameters
[in]memberMember pointer to encapsulate.
Returns
New member capsule or empty object if the exception indicator got set.

◆ CPyMem_SetAllocator()

MAXON_METHOD Result<void> CPyMem_SetAllocator ( CPyMemAllocatorDomain  domain,
CPyMemAllocatorEx allocator 
)

◆ MPyClass_New()

MAXON_METHOD MPyClassRef MPyClass_New ( const reflection::Class cls)

Creates a class capsule that encapsulates a reflection::Member pointer.

Parameters
[in]clsClass pointer to encapsulate.
Returns
New class capsule or empty object if the exception indicator got set.

◆ CPy_UTF8Mode()

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.

Returns
UTF8Mode

◆ CPy_DebugFlag()

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.

Returns
DebugFlag flag

◆ CPy_VerboseFlag()

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.

Returns
VerboseFlag flag

◆ CPy_QuietFlag()

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.

Returns
QuietFlag flag

◆ CPy_InteractiveFlag()

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.

Returns
InteractiveFlag flag

◆ CPy_InspectFlag()

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.

Returns
InspectFlag flag

◆ CPy_OptimizeFlag()

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.

Returns
OptimizeFlag flag

◆ CPy_NoSiteFlag()

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.

Returns
NoSiteFlag flag

◆ CPy_BytesWarningFlag()

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.

Returns
BytesWarningFlag flag

◆ CPy_FrozenFlag()

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.

Returns
FrozenFlag flag

◆ CPy_IgnoreEnvironmentFlag()

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.

Returns
IgnoreEnvironmentFlag flag

◆ CPy_DontWriteBytecodeFlag()

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.

Returns
DontWriteBytecodeFlag flag

◆ CPy_NoUserSiteDirectory()

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.

Returns
NoUserSiteDirectory flag

◆ CPy_UnbufferedStdioFlag()

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.

Returns
UnbufferedStdioFlag flag

◆ CPy_IsolatedFlag()

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.

Returns
IsolatedFlag flag

◆ CPyExc_BaseException()

MAXON_METHOD CPyConstRef CPyExc_BaseException ( )

Returns the BaseException.

Returns
The BaseException exception.

◆ CPyExc_Exception()

MAXON_METHOD CPyConstRef CPyExc_Exception ( )

Returns the Exception.

Returns
The Exception exception.

◆ CPyExc_StopIteration()

MAXON_METHOD CPyConstRef CPyExc_StopIteration ( )

Returns the StopIteration.

Returns
The StopIteration exception.

◆ CPyExc_GeneratorExit()

MAXON_METHOD CPyConstRef CPyExc_GeneratorExit ( )

Returns the GeneratorExit.

Returns
The GeneratorExit exception.

◆ CPyExc_StandardError()

MAXON_METHOD CPyConstRef CPyExc_StandardError ( )

Returns the StandardError.

Returns
The StandardError exception.

◆ CPyExc_ArithmeticError()

MAXON_METHOD CPyConstRef CPyExc_ArithmeticError ( )

Returns the ArithmeticError.

Returns
The ArithmeticError exception.

◆ CPyExc_LookupError()

MAXON_METHOD CPyConstRef CPyExc_LookupError ( )

Returns the LookupError.

Returns
The LookupError exception.

◆ CPyExc_AssertionError()

MAXON_METHOD CPyConstRef CPyExc_AssertionError ( )

Returns the AssertionError.

Returns
The AssertionError exception.

◆ CPyExc_AttributeError()

MAXON_METHOD CPyConstRef CPyExc_AttributeError ( )

Returns the AttributeError.

Returns
The AttributeError exception.

◆ CPyExc_EOFError()

MAXON_METHOD CPyConstRef CPyExc_EOFError ( )

Returns the EOFError.

Returns
The EOFError exception.

◆ CPyExc_FloatingPointError()

MAXON_METHOD CPyConstRef CPyExc_FloatingPointError ( )

Returns the FloatingPointError.

Returns
The FloatingPointError exception.

◆ CPyExc_EnvironmentError()

MAXON_METHOD CPyConstRef CPyExc_EnvironmentError ( )

Returns the EnvironmentError.

Returns
The EnvironmentError exception.

◆ CPyExc_IOError()

MAXON_METHOD CPyConstRef CPyExc_IOError ( )

Returns the IOError.

Returns
The IOError exception.

◆ CPyExc_OSError()

MAXON_METHOD CPyConstRef CPyExc_OSError ( )

Returns the OSError.

Returns
The OSError exception.

◆ CPyExc_ImportError()

MAXON_METHOD CPyConstRef CPyExc_ImportError ( )

Returns the ImportError.

Returns
The ImportError exception.

◆ CPyExc_IndexError()

MAXON_METHOD CPyConstRef CPyExc_IndexError ( )

Returns the IndexError.

Returns
The IndexError exception.

◆ CPyExc_KeyError()

MAXON_METHOD CPyConstRef CPyExc_KeyError ( )

Returns the KeyError.

Returns
The KeyError exception.

◆ CPyExc_KeyboardInterrupt()

MAXON_METHOD CPyConstRef CPyExc_KeyboardInterrupt ( )

Returns the KeyboardInterrupt.

Returns
The KeyboardInterrupt exception.

◆ CPyExc_MemoryError()

MAXON_METHOD CPyConstRef CPyExc_MemoryError ( )

Returns the MemoryError.

Returns
The MemoryError exception.

◆ CPyExc_NameError()

MAXON_METHOD CPyConstRef CPyExc_NameError ( )

Returns the NameError.

Returns
The NameError exception.

◆ CPyExc_OverflowError()

MAXON_METHOD CPyConstRef CPyExc_OverflowError ( )

Returns the OverflowError.

Returns
The OverflowError exception.

◆ CPyExc_RuntimeError()

MAXON_METHOD CPyConstRef CPyExc_RuntimeError ( )

Returns the RuntimeError.

Returns
The RuntimeError exception.

◆ CPyExc_NotImplementedError()

MAXON_METHOD CPyConstRef CPyExc_NotImplementedError ( )

Returns the NotImplementedError.

Returns
The NotImplementedError exception.

◆ CPyExc_SyntaxError()

MAXON_METHOD CPyConstRef CPyExc_SyntaxError ( )

Returns the SyntaxError.

Returns
The SyntaxError exception.

◆ CPyExc_IndentationError()

MAXON_METHOD CPyConstRef CPyExc_IndentationError ( )

Returns the IndentationError.

Returns
The IndentationError exception.

◆ CPyExc_TabError()

MAXON_METHOD CPyConstRef CPyExc_TabError ( )

Returns the TabError.

Returns
The TabError exception.

◆ CPyExc_ReferenceError()

MAXON_METHOD CPyConstRef CPyExc_ReferenceError ( )

Returns the ReferenceError.

Returns
The ReferenceError exception.

◆ CPyExc_SystemError()

MAXON_METHOD CPyConstRef CPyExc_SystemError ( )

Returns the SystemError.

Returns
The SystemError exception.

◆ CPyExc_SystemExit()

MAXON_METHOD CPyConstRef CPyExc_SystemExit ( )

Returns the SystemExit.

Returns
The SystemExit exception.

◆ CPyExc_TypeError()

MAXON_METHOD CPyConstRef CPyExc_TypeError ( )

Returns the TypeError.

Returns
The TypeError exception.

◆ CPyExc_UnboundLocalError()

MAXON_METHOD CPyConstRef CPyExc_UnboundLocalError ( )

Returns the UnboundLocalError.

Returns
The UnboundLocalError exception.

◆ CPyExc_UnicodeError()

MAXON_METHOD CPyConstRef CPyExc_UnicodeError ( )

Returns the UnicodeError.

Returns
The UnicodeError exception.

◆ CPyExc_UnicodeEncodeError()

MAXON_METHOD CPyConstRef CPyExc_UnicodeEncodeError ( )

Returns the UnicodeEncodeError.

Returns
The UnicodeEncodeError exception.

◆ CPyExc_UnicodeDecodeError()

MAXON_METHOD CPyConstRef CPyExc_UnicodeDecodeError ( )

Returns the UnicodeDecodeError.

Returns
The UnicodeDecodeError exception.

◆ CPyExc_UnicodeTranslateError()

MAXON_METHOD CPyConstRef CPyExc_UnicodeTranslateError ( )

Returns the UnicodeTranslateError.

Returns
The UnicodeTranslateError exception.

◆ CPyExc_ValueError()

MAXON_METHOD CPyConstRef CPyExc_ValueError ( )

Returns the ValueError.

Returns
The ValueError exception.

◆ CPyExc_ZeroDivisionError()

MAXON_METHOD CPyConstRef CPyExc_ZeroDivisionError ( )

Returns the ZeroDivisionError.

Returns
The ZeroDivisionError exception.

◆ CPyExc_WindowsError()

MAXON_METHOD CPyConstRef CPyExc_WindowsError ( )

Returns the WindowsError.

Returns
The WindowsError exception.

◆ CPyExc_BufferError()

MAXON_METHOD CPyConstRef CPyExc_BufferError ( )

Returns the BufferError.

Returns
The BufferError exception.

◆ CPyExc_MemoryErrorInst()

MAXON_METHOD CPyConstRef CPyExc_MemoryErrorInst ( )

Returns the MemoryErrorInst.

Returns
The MemoryErrorInst exception.

◆ CPyExc_Warning()

MAXON_METHOD CPyConstRef CPyExc_Warning ( )

Returns the Warning.

Returns
The Warning exception.

◆ CPyExc_UserWarning()

MAXON_METHOD CPyConstRef CPyExc_UserWarning ( )

Returns the UserWarning.

Returns
The UserWarning exception.

◆ CPyExc_DeprecationWarning()

MAXON_METHOD CPyConstRef CPyExc_DeprecationWarning ( )

Returns the DeprecationWarning.

Returns
The DeprecationWarning exception.

◆ CPyExc_PendingDeprecationWarning()

MAXON_METHOD CPyConstRef CPyExc_PendingDeprecationWarning ( )

Returns the PendingDeprecationWarning.

Returns
The PendingDeprecationWarning exception.

◆ CPyExc_SyntaxWarning()

MAXON_METHOD CPyConstRef CPyExc_SyntaxWarning ( )

Returns the SyntaxWarning.

Returns
The SyntaxWarning exception.

◆ CPyExc_RuntimeWarning()

MAXON_METHOD CPyConstRef CPyExc_RuntimeWarning ( )

Returns the RuntimeWarning.

Returns
The RuntimeWarning exception.

◆ CPyExc_FutureWarning()

MAXON_METHOD CPyConstRef CPyExc_FutureWarning ( )

Returns the FutureWarning.

Returns
The FutureWarning exception.

◆ CPyExc_ImportWarning()

MAXON_METHOD CPyConstRef CPyExc_ImportWarning ( )

Returns the ImportWarning.

Returns
The ImportWarning exception.

◆ CPyExc_UnicodeWarning()

MAXON_METHOD CPyConstRef CPyExc_UnicodeWarning ( )

Returns the UnicodeWarning.

Returns
The UnicodeWarning exception.

◆ CPyExc_BytesWarning()

MAXON_METHOD CPyConstRef CPyExc_BytesWarning ( )

Returns the BytesWarning.

Returns
The BytesWarning exception.

◆ CPyNullImporter_Type()

MAXON_METHOD CPyTypeConstRef CPyNullImporter_Type ( )

Returns the CPyNullItype of CPyNullImporter.

Returns
Type of CPyNullImporter.

◆ CPySuper_Type()

MAXON_METHOD CPyTypeConstRef CPySuper_Type ( )

Returns the Ctype of CPySuper.

Returns
Type of CPySuper.

◆ CPyBool_Type()

MAXON_METHOD CPyTypeConstRef CPyBool_Type ( )

Returns the type of CPyBool.

Returns
Type of CPyBool.

◆ CPyObject_Type()

MAXON_METHOD CPyTypeConstRef CPyObject_Type ( )

Returns the CPtype of CPyObject.

Returns
Type of CPyObject.

◆ CPyModule_Type()

MAXON_METHOD CPyTypeConstRef CPyModule_Type ( )

Returns the CPtype of CPyModule.

Returns
Type of CPyModule.

◆ CPyUnicode_Type()

MAXON_METHOD CPyTypeConstRef CPyUnicode_Type ( )

Returns the CPtype of CPyUnicode.

Returns
Type of CPyUnicode.

◆ CPyLong_Type()

MAXON_METHOD CPyTypeConstRef CPyLong_Type ( )

Returns the type of CPyLong.

Returns
Type of CPyLong.

◆ CPyFloat_Type()

MAXON_METHOD CPyTypeConstRef CPyFloat_Type ( )

Returns the Ctype of CPyFloat.

Returns
Type of CPyFloat.

◆ CPyTuple_Type()

MAXON_METHOD CPyTypeConstRef CPyTuple_Type ( )

Returns the Ctype of CPyTuple.

Returns
Type of CPyTuple.

◆ CPyList_Type()

MAXON_METHOD CPyTypeConstRef CPyList_Type ( )

Returns the type of CPyList.

Returns
Type of CPyList.

◆ CPyDict_Type()

MAXON_METHOD CPyTypeConstRef CPyDict_Type ( )

Returns the type of CPyDict.

Returns
Type of CPyDict.

◆ CPyClass_Type()

MAXON_METHOD CPyTypeConstRef CPyClass_Type ( )

Returns the Ctype of CPyClass.

Returns
Type of CPyClass.

◆ CPyTraceBack_Type()

MAXON_METHOD CPyTypeConstRef CPyTraceBack_Type ( )

Returns the CPyTrtype of CPyTraceBack.

Returns
Type of CPyTraceBack.

◆ CPySlice_Type()

MAXON_METHOD CPyTypeConstRef CPySlice_Type ( )

Returns the Ctype of CPySlice.

Returns
Type of CPySlice.

◆ CPyType_Type()

MAXON_METHOD CPyTypeConstRef CPyType_Type ( )

Returns the type of CPyType.

Returns
Type of CPyType.

◆ CPyMemoryView_Type()

MAXON_METHOD CPyTypeConstRef CPyMemoryView_Type ( )

Returns the CPyMemtype of CPyMemoryView.

Returns
Type of CPyMemoryView.

◆ ConvertAndCacheString()

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.

Parameters
[in]strString to convert.
[in]encodingEncoding to use.
Returns
Pointer to the first array of the string sequence. Can be casted to the corresponding code unit type.

◆ RegisterSpecificPythonClass()

MAXON_METHOD Result<void> RegisterSpecificPythonClass ( const Id typeId,
const CPyTypeRef type 
)

Private.

◆ PrivateRegisterBuiltinConverter()

MAXON_METHOD Result<void> PrivateRegisterBuiltinConverter ( const DataType dt,
const DelegatePyObject_AsData f1,
const DelegatePyObject_FromData<> &  f2 
)

Registers a lambda for back- and forth conversions of certain DataTypes.

Parameters
[in]dtDataType the converters can handle.
[in]f1Lambda or function to convert a Python object to a Data object.
[in]f2Lambda or function which converts a Data object to a Python object.
Returns
OK on success.

◆ RegisterBuiltinConverter()

MAXON_FUNCTION Result<void> RegisterBuiltinConverter ( const DelegatePyObject_AsData f1,
const DelegatePyObject_FromData< T > &  f2 
)

◆ GetUrl()

static MAXON_METHOD Result<void> GetUrl ( DEFAULTRUNTIME  pythonPath,
Url pythonLibrary,
Url pythonHome 
)
static

static helper functions

◆ GetSpecialPath()

MAXON_METHOD Url GetSpecialPath ( SPECIALPATH  )

◆ RegisterSpecialPath()

MAXON_METHOD void RegisterSpecialPath ( SPECIALPATH  ,
const Url path 
)

◆ MPyDataCapsule_Type()

MAXON_METHOD CPyTypeConstRef MPyDataCapsule_Type ( )

◆ CPyData_Type()

MAXON_METHOD CPyTypeConstRef CPyData_Type ( )

◆ CPyCapsule_Type()

MAXON_METHOD CPyTypeConstRef CPyCapsule_Type ( )

◆ CPyId_Type()

MAXON_METHOD CPyTypeConstRef CPyId_Type ( )

◆ CPyInternedId_Type()

MAXON_METHOD CPyTypeConstRef CPyInternedId_Type ( )

◆ PrivateGetCurrentCallerContext()

MAXON_METHOD CPyRef PrivateGetCurrentCallerContext ( )

Private.

◆ MPyDataType_ToMapperInstance()

MAXON_METHOD CPyRef MPyDataType_ToMapperInstance ( const CPyRef capsule)

◆ MPyData_ToMapperInstance()

MAXON_METHOD CPyRef MPyData_ToMapperInstance ( const MPyDataRef capsule)

◆ CPyObject_ToMapperInstance()

MAXON_METHOD CPyRef CPyObject_ToMapperInstance ( const DataType dt,
const CPyRef capsule 
)

◆ AssociateDataTypeWithPythonTypes()

MAXON_METHOD Result<void> AssociateDataTypeWithPythonTypes ( const DataType dt,
const CPyRef type 
)

◆ GetAssociatedDataType()

MAXON_METHOD Result<CPyRef> GetAssociatedDataType ( const DataType dt)

◆ GetConverterPyObject_FromData()

MAXON_METHOD DelegatePyObject_FromData* GetConverterPyObject_FromData ( const DataType dt)

◆ MPyData_New() [1/2]

MAXON_METHOD MPyDataRef MPyData_New ( Data data)

◆ MPyData_New() [2/2]

MAXON_METHOD MPyDataRef MPyData_New ( const DataType dt,
Generic *  data,
Bool  owner,
const DataType mapDt = DataType::NullValue() 
)

◆ MPyDataType_New()

MAXON_METHOD MPyDataTypeRef MPyDataType_New ( const DataType dt)

Creates a DataType capsule. GIL must be held.

Parameters
dtPointer of DataType to capsule.
Returns
New DataType capsule or empty object if exception indicator is set.

◆ MPyDataType_CheckExact()

MAXON_METHOD Bool MPyDataType_CheckExact ( const CPyRef o) const

Checks if the given object is a DataType capsule. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a DataType capsule.

◆ MPyDataType_GetDataType()

MAXON_METHOD const DataType& MPyDataType_GetDataType ( const MPyDataTypeRef o) const

Returns the internal DataType pointer of a DataType capsule. GIL must be held.

Parameters
[in]oDataType capsule.
Returns
DataType pointer or nullptr.

◆ MPyData_CheckExact()

MAXON_METHOD Bool MPyData_CheckExact ( const CPyRef o) const

Checks if the given object is a Data capsule. GIL must be held.

Parameters
[in]oA given object.
Returns
True if o is a DataType capsule.

◆ CPyObject_AsData()

MAXON_METHOD Result<Data*> CPyObject_AsData ( Int  stackDepth,
const CPyRef obj,
const DataType expected,
BlockArray< Data > &  k,
BaseArray< reflection::Argument > *  n = nullptr 
)

◆ GetRegisteredTypesWithConversions()

MAXON_METHOD Result<BaseArray<TYPE_CONVERSION_TUPLE> > GetRegisteredTypesWithConversions ( )

◆ ParseArgument() [1/3]

MAXON_FUNCTION std::enable_if< STD_IS_REPLACEMENT(same, T, DataType), ResultPtr< DataType > >::type ParseArgument ( const CPyRef args,
Int32  argIndex,
Bool  isOptional = false 
)

◆ ParseRef()

MAXON_FUNCTION Result< T > ParseRef ( const CPyRef args,
Int32  argIndex,
Bool  isOptional = false 
)

◆ ParseArgument() [2/3]

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 
)

◆ ParseArgument() [3/3]

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*

◆ ParseDataType()

MAXON_METHOD Result<DataType> ParseDataType ( const CPyRef args,
Int32  argIndex,
Bool  canBeNone = false 
)

◆ ParseGeneric()

MAXON_FUNCTION Result< T > ParseGeneric ( const CPythonLibraryRef &  pylib,
const CPyRef args,
Int32  argIndex,
DataType dt,
Bool  unpackData 
)

◆ SetError() [1/2]

MAXON_METHOD void SetError ( const Error &  err)

◆ SetError() [2/2]

MAXON_METHOD void SetError ( const ErrorPtr err)

◆ MaxonConvertAuto()

MAXON_METHOD CPyRef MaxonConvertAuto ( const CPyRef capsule)

◆ CPyObject_FromGeneric()

MAXON_METHOD CPyRef CPyObject_FromGeneric ( const DataType origDt,
const Generic *  object,
OWNERSHIP  ownership,
const CPyTypeRef expected = nullptr,
Int count = nullptr 
)

◆ CreateGlobalDictionary()

MAXON_METHOD CPyRef CreateGlobalDictionary ( ) const

Creates a scope dictionary which has all built-in modules preset.

Returns
New dictionary object.

◆ GetCurrentTraceback()

MAXON_METHOD Result<BaseArray<SourceLocation> > GetCurrentTraceback ( )

◆ Enum_ToMapperInstance()

MAXON_FUNCTION CPyRef Enum_ToMapperInstance ( enumm)

◆ GetCPyRefClass()

MAXON_METHOD Class<CPyRef> GetCPyRefClass ( ) const

Same As CPyReference3 but preferred.

◆ GetCPyTypeRefClass()

MAXON_METHOD Class<CPyTypeRef> GetCPyTypeRefClass ( ) const

◆ GetCPyFrameRefClass()

MAXON_METHOD Class<CPyFrameRef> GetCPyFrameRefClass ( ) const

◆ GetCPyTracebackRefClass()

MAXON_METHOD Class<CPyTracebackRef> GetCPyTracebackRefClass ( ) const

◆ GetCPyCodeRefClass()

MAXON_METHOD Class<CPyCodeRef> GetCPyCodeRefClass ( ) const

◆ GetMPyClassRefClass()

MAXON_METHOD Class<MPyClassRef> GetMPyClassRefClass ( ) const

◆ GetMPyMemberRefClass()

MAXON_METHOD Class<MPyMemberRef> GetMPyMemberRefClass ( ) const

◆ GetMPyFunctionRefClass()

MAXON_METHOD Class<MPyFunctionRef> GetMPyFunctionRefClass ( ) const

◆ GetMPyHashMapRefClass()

MAXON_METHOD Class<MPyHashMapRef> GetMPyHashMapRefClass ( ) const

◆ GetMPyDataTypeRefClass()

MAXON_METHOD Class<MPyDataTypeRef> GetMPyDataTypeRefClass ( ) const

◆ GetMPyDataRefClass()

MAXON_METHOD Class<MPyDataRef> GetMPyDataRefClass ( ) const

◆ GetMPyCallerContextRefClass()

MAXON_METHOD Class<MPyCallerContextRef> GetMPyCallerContextRefClass ( ) const