cpython.h File Reference

Classes

struct  ErrorStorage
 
struct  ModuleDefinition
 
struct  PythonDll
 
struct  CPyMemAllocatorEx
 
class  PythonErrorInterface
 
class  PythonTracebackErrorInterface
 
class  PythonSystemExitErrorInterface
 
struct  ProxyDefinition
 
class  CPythonLibraryInterface
 
struct  Tuple
 
struct  BaseArray
 
class  Slice
 
class  PyModuleInterface
 
struct  CPythonGil
 

Namespaces

 maxon
 
 maxon::py
 
 maxon::py::specialtype
 
 maxon::CPythonLibs
 

Macros

#define PY_VERSION_MAJOR
 
#define PY_VERSION_MINOR
 
#define PY_VERSION_MICRO
 
#define Python3Output(formatString, ...)
 
#define CPYREFDIAGNOSTICOUTPUT(ref)
 
#define PRIVATE_MAXON_CPYTHON_FUNCTION(funcname, args)
 
#define PRIVATE_MAXON_CPYTHON_STACK()
 
#define PRIVATE_MAXON_CPYTHON_FUNCTION_REGISTER(funcname, SUPERTYPE)
 
#define PRIVATE_MAXON_ifpyerr_scope()
 
#define PRIVATE_MAXON_ifpyerr_return()
 
#define NO_CONSTANTS
 
#define PRIVATE_MAXON_COMPONENT_CPYTHON_MODULE(NO_CONSTANTS)
 
#define MAXON_COMPONENT_CPYTHON_MODULE(NO_CONSTANTS)
 
#define MAXON_PYTHON_RELEASE_GIL(pylib)
 
#define MAXON_PYTHON_ACQUIRE_GIL(pylib)
 
#define ifpyerr_scope
 
#define ifpyerr_return
 
#define MAXON_CPYTHON_FUNCTION(funcname, args)
 
#define MAXON_CPYTHON_STACK()
 
#define MAXON_CPYTHON_FUNCTION_REGISTER(funcname)
 
#define MAXON_CPYTHON_FUNCTION_SUBTYPE_REGISTER(funcname, SUPERTYPE)
 

Typedefs

using FunctionRegistration = Delegate< Result< void >(py::NativePyCFunctionWithKeywords func)>
 
template<typename T = Generic>
using DelegatePyObject_FromData = Delegate< CPyRef(const T *, const CPyTypeRef &expected)>
 
using CPyCapsule_Destructor = void(NativePyObject *)
 
using DelegatePyObject_AsData = Delegate< Result< Bool >(const DataType &expected, const CPyRef &src, Data *dst)>
 
using NativePyCFunctionTable = Tuple< const Char *, py::NativePyCFunctionWithKeywords >
 

Enumerations

enum class  PyStringEncodings {
  Utf8 ,
  Utf16 ,
  Utf32 ,
  PyDecode
}
 
enum class  OWNERSHIP {
  NORMAL ,
  CALLER ,
  CALLEE ,
  CALLER_BUT_COPY
}
 
enum class  PATHHANDLE {
  OVERWRITE ,
  APPEND_AT_END ,
  INSERT_AT_BEGINNING
}
 
enum class  GILSTATE {
  NOT_ACTIVE ,
  ACTIVE_BUT_NOT_CURRENT_THREAD ,
  ACTIVE_AND_CURRENT_THREAD
}
 
enum class  CPyMemAllocatorDomain {
  CPYMEM_DOMAIN_RAW ,
  CPYMEM_DOMAIN_MEM ,
  CPYMEM_DOMAIN_OBJ
}
 
enum class  SPECIALPATH {
  MAXON_MODULES ,
  PREFS_PYTHON_GENERATED_DIRECTORY ,
  PREFS_PYTHON_GLOBAL_LIBS ,
  PREFS_PYTHON_LOCAL_LIBS
}
 
enum class  PYGILSTATE {
  LOCKED ,
  UNLOCKED
}
 
enum class  PYINPUT {
  SINGLE ,
  FILE ,
  EVAL
}
 
enum class  PYSTARTOPERATION {
  NONE ,
  EXECUTE_CODE ,
  EXECUTE_MODULE ,
  EXECUTE_FILE ,
  VERSION
}
 

Functions

 MAXON_DEPENDENCY_WEAK ("maxon/vm.h")
 
 MAXON_DEPENDENCY_WEAK ("maxon/cpython_raw.h")
 
 MAXON_DEPENDENCY_WEAK ("maxon/cpython_ref.h")
 
enum maxon::PyStringEncodings MAXON_ENUM_LIST (PyStringEncodings)
 
enum maxon::OWNERSHIP MAXON_ENUM_LIST (OWNERSHIP)
 
MAXON_ATTRIBUTE_FORCE_INLINE ErrorStorage operator/ (const FunctionRegistration &reg, py::NativePyCFunctionWithKeywords func)
 
enum maxon::py::PATHHANDLE MAXON_ENUM_LIST (PATHHANDLE)
 
enum maxon::py::GILSTATE MAXON_ENUM_LIST (GILSTATE)
 
enum maxon::py::CPyMemAllocatorDomain MAXON_ENUM_LIST (CPyMemAllocatorDomain)
 
enum maxon::py::SPECIALPATH MAXON_ENUM_LIST (SPECIALPATH)
 
enum maxon::py::PYGILSTATE MAXON_ENUM_LIST (PYGILSTATE)
 
enum maxon::py::PYINPUT MAXON_ENUM_LIST (PYINPUT)
 
enum maxon::py::PYSTARTOPERATION MAXON_ENUM_LIST (PYSTARTOPERATION)
 
 MAXON_DATATYPE (NativePyObject, "net.maxon.python.datatype.nativepyobject")
 
 MAXON_DATATYPE (Tuple, "net.maxon.python.datatype.tuple")
 
 MAXON_DATATYPE (Slice, "net.maxon.python.datatype.slice")
 
 MAXON_DATATYPE (BaseArray, "net.maxon.python.datatype.basearray")
 
template<typename T >
MAXON_ATTRIBUTE_FORCE_INLINE Bool PassedRefCheck (const CPyRef &o)
 
template<>
MAXON_ATTRIBUTE_FORCE_INLINE Bool PassedRefCheck< MPyDataRef > (const CPyRef &o)
 
template<typename T >
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< STD_IS_REPLACEMENT(pointer, T), T >::type PrivateGetPtr (Data *data)
 
template<typename T >
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< STD_IS_REPLACEMENT(reference, T), T >::type PrivateGetPtr (Data *data)
 
template<>
MAXON_ATTRIBUTE_FORCE_INLINE Data & PrivateGetPtr< Data & > (Data *data)
 
template<>
MAXON_ATTRIBUTE_FORCE_INLINE Data * PrivateGetPtr< Data * > (Data *data)
 
 MAXON_REGISTRY (Class< PyModuleRef >, PyModules, "net.maxon.python.registry.pymodules")
 
 MAXON_REGISTRY (Class< LibraryRef >, CPythonLibs, "net.maxon.python.registry.cpythonlibs")
 
 MAXON_DECLARATION (Class< LibraryRef >, Lib3, "net.maxon.python.cpythonlibs.cpy3")
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::CPyTypeRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::CPyFrameRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::CPyTracebackRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::CPyCodeRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyClassRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyMemberRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyFunctionRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyHashMapRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyDataTypeRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyDataRef), T >::type CPyCast (const CPyRef &o)
 
template<typename T >
std::enable_if< STD_IS_REPLACEMENT(same, T, py::MPyCallerContextRef), T >::type CPyCast (const CPyRef &o)
 
py::CPythonLibraryRef PrivateExtractCPythonLibrary3 (py::NativePyObject *self)
 
void _Python3Output (maxon::TARGETAUDIENCE audience, const Char *str, Int line, const Char *file, maxon::WRITEMETA meta=maxon::WRITEMETA::DEFAULT)
 
void _Python3Output (maxon::TARGETAUDIENCE audience, const maxon::String &str, Int line, const Char *file)
 
void _Python3Output (maxon::TARGETAUDIENCE audience, maxon::StringProxy *proxy, Int line, const Char *file)
 
maxon::Error PrivateRegisterCPythonFunc (const Char *name, py::NativePyCFunctionWithKeywords underlyingFunc3, BaseArray< NativePyCFunctionTable > &functions3)
 
void PrivateCPyRefDiagnosticOutput (MAXON_SOURCE_LOCATION_DECLARATION, const Char *refName, const py::CPyRef &ref)
 

Variables

 Utf8
 
 Utf16
 
 Utf32
 
 PyDecode
 
const Id ID_LOGGER_PYTHON
 
 NORMAL
 
 CALLER
 
 CALLEE
 
 CALLER_BUT_COPY
 
 OVERWRITE
 
 APPEND_AT_END
 
 INSERT_AT_BEGINNING
 
 NOT_ACTIVE
 
 ACTIVE_BUT_NOT_CURRENT_THREAD
 
 ACTIVE_AND_CURRENT_THREAD
 
struct maxon::py::ModuleDefinition MAXON_ENUM_LIST
 
 CPYMEM_DOMAIN_RAW
 
 CPYMEM_DOMAIN_MEM
 
 CPYMEM_DOMAIN_OBJ
 
 MAXON_MODULES
 
 PREFS_PYTHON_GENERATED_DIRECTORY
 
 PREFS_PYTHON_GLOBAL_LIBS
 
 PREFS_PYTHON_LOCAL_LIBS
 
 LOCKED
 
 UNLOCKED
 
 SINGLE
 
 FILE
 
 EVAL
 
 NONE
 
 EXECUTE_CODE
 
 EXECUTE_MODULE
 
 EXECUTE_FILE
 
 VERSION
 

Macro Definition Documentation

◆ PY_VERSION_MAJOR

#define PY_VERSION_MAJOR

◆ PY_VERSION_MINOR

#define PY_VERSION_MINOR

◆ PY_VERSION_MICRO

#define PY_VERSION_MICRO

◆ Python3Output

#define Python3Output (   formatString,
  ... 
)

Python3Output outputs text into the console under the Python 3 category. The full output syntax can be used for the format string. Note that if you do not specify any additional parameters after the formatting string no formatting takes place - the raw string will stay unchanged. THREADSAFE.

◆ CPYREFDIAGNOSTICOUTPUT

#define CPYREFDIAGNOSTICOUTPUT (   ref)

◆ PRIVATE_MAXON_CPYTHON_FUNCTION

#define PRIVATE_MAXON_CPYTHON_FUNCTION (   funcname,
  args 
)

◆ PRIVATE_MAXON_CPYTHON_STACK

#define PRIVATE_MAXON_CPYTHON_STACK ( )

◆ PRIVATE_MAXON_CPYTHON_FUNCTION_REGISTER

#define PRIVATE_MAXON_CPYTHON_FUNCTION_REGISTER (   funcname,
  SUPERTYPE 
)

◆ PRIVATE_MAXON_ifpyerr_scope

#define PRIVATE_MAXON_ifpyerr_scope ( )

◆ PRIVATE_MAXON_ifpyerr_return

#define PRIVATE_MAXON_ifpyerr_return ( )

◆ NO_CONSTANTS

#define NO_CONSTANTS

◆ PRIVATE_MAXON_COMPONENT_CPYTHON_MODULE

#define PRIVATE_MAXON_COMPONENT_CPYTHON_MODULE (   NO_CONSTANTS)

◆ MAXON_COMPONENT_CPYTHON_MODULE

#define MAXON_COMPONENT_CPYTHON_MODULE (   NO_CONSTANTS)

Required macro in the Python module scope to define if the module defines constants or not. Example:

class PyExampleModule : public Component<PyExampleModule, PyModuleInterface>
{
public:
{
return pylib.CPy_None();
}
};
PyObject * args
Definition: abstract.h:159
#define MAXON_CPYTHON_STACK()
Makes the 'pylib' variable available and defines a stack which is used by several parsing functions t...
Definition: cpython.h:3260
#define MAXON_COMPONENT_CPYTHON_MODULE(NO_CONSTANTS)
Definition: cpython.h:3211
#define NO_CONSTANTS
Definition: cpython.h:3175
#define MAXON_CPYTHON_FUNCTION(funcname, args)
Definition: cpython.h:3255
#define MAXON_CPYTHON_FUNCTION_REGISTER(funcname)
Definition: cpython.h:3282
ComponentWithBase< C, ComponentRoot, INTERFACES... > Component
Definition: objectbase.h:2798
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2212

◆ MAXON_PYTHON_RELEASE_GIL

#define MAXON_PYTHON_RELEASE_GIL (   pylib)

◆ MAXON_PYTHON_ACQUIRE_GIL

#define MAXON_PYTHON_ACQUIRE_GIL (   pylib)

◆ ifpyerr_scope

#define ifpyerr_scope

Similar to iferr_scope, but used in combination with ifpyerr_return to automatically convert an exception and to set the exception indicator of Python.

◆ ifpyerr_return

#define ifpyerr_return

Similar to iferr_return, but used in combination with ifpyerr_scope to automatically convert an exception and to set the exception indicator of Python.

Result<void> DoSomething();
CPyRef Convert(const CPythonLibraryRef& pylib)
{
DoSomething() ifpyerr_return;
return pylib.CPy_None();
}
#define ifpyerr_scope
Similar to iferr_scope, but used in combination with ifpyerr_return to automatically convert an excep...
Definition: cpython.h:3217
#define ifpyerr_return
Definition: cpython.h:3233

◆ MAXON_CPYTHON_FUNCTION

#define MAXON_CPYTHON_FUNCTION (   funcname,
  args 
)

Defines a lambda in a Python C-module.

class PyExampleModule : public Component<PyExampleModule, PyModuleInterface>
{
public:
{
return pylib.CPy_None();
}
};

◆ MAXON_CPYTHON_STACK

#define MAXON_CPYTHON_STACK ( )

Makes the 'pylib' variable available and defines a stack which is used by several parsing functions to convert objects to the requested.

◆ MAXON_CPYTHON_FUNCTION_REGISTER

#define MAXON_CPYTHON_FUNCTION_REGISTER (   funcname)

Macro to register a lambda in a Python C-module. Example:

class PyExampleModule : public Component<PyExampleModule, PyModuleInterface>
{
public:
{
return pylib.CPy_None();
}
};

◆ MAXON_CPYTHON_FUNCTION_SUBTYPE_REGISTER

#define MAXON_CPYTHON_FUNCTION_SUBTYPE_REGISTER (   funcname,
  SUPERTYPE 
)

Function Documentation

◆ MAXON_DEPENDENCY_WEAK() [1/3]

MAXON_DEPENDENCY_WEAK ( "maxon/vm.h"  )

◆ MAXON_DEPENDENCY_WEAK() [2/3]

MAXON_DEPENDENCY_WEAK ( "maxon/cpython_raw.h"  )

◆ MAXON_DEPENDENCY_WEAK() [3/3]

MAXON_DEPENDENCY_WEAK ( "maxon/cpython_ref.h"  )

Variable Documentation

◆ Utf8

Utf8

◆ Utf16

Utf16

◆ Utf32

Utf32

◆ PyDecode

PyDecode

◆ NORMAL

NORMAL

◆ CALLER

CALLER

Default ownership.

◆ CALLEE

CALLEE

Caller owns the object.

◆ CALLER_BUT_COPY

CALLER_BUT_COPY

Callee owns the object.

◆ OVERWRITE

OVERWRITE

◆ APPEND_AT_END

APPEND_AT_END

Overwrite sys.path.

◆ INSERT_AT_BEGINNING

INSERT_AT_BEGINNING

Append array to sys.path.

Insert array at sys.path[0]

◆ NOT_ACTIVE

NOT_ACTIVE

◆ ACTIVE_BUT_NOT_CURRENT_THREAD

ACTIVE_BUT_NOT_CURRENT_THREAD

GIL is not hold by any thread.

◆ ACTIVE_AND_CURRENT_THREAD

ACTIVE_AND_CURRENT_THREAD

GIL is hold by another thread.

◆ CPYMEM_DOMAIN_RAW

CPYMEM_DOMAIN_RAW

◆ CPYMEM_DOMAIN_MEM

CPYMEM_DOMAIN_MEM

◆ CPYMEM_DOMAIN_OBJ

CPYMEM_DOMAIN_OBJ

◆ MAXON_MODULES

MAXON_MODULES

◆ PREFS_PYTHON_GENERATED_DIRECTORY

PREFS_PYTHON_GENERATED_DIRECTORY

Path to the 'maxon' module.

◆ PREFS_PYTHON_GLOBAL_LIBS

PREFS_PYTHON_GLOBAL_LIBS

Path to the 'generated' directory.

◆ PREFS_PYTHON_LOCAL_LIBS

PREFS_PYTHON_LOCAL_LIBS

Path to the globals 'libs directory which all Cinema 4D instances share.

Path to the local 'libs directory which only the current Cinema 4D instance uses.

◆ LOCKED

LOCKED

◆ UNLOCKED

UNLOCKED

GIL is locked.

GIL is unlocked.

◆ SINGLE

SINGLE

◆ FILE

FILE

The start symbol from the Python grammar for a single statement.

◆ EVAL

EVAL

The start symbol from the Python grammar for sequences of statements as read from a file or other source.

◆ NONE

NONE

◆ EXECUTE_CODE

EXECUTE_CODE

◆ EXECUTE_MODULE

EXECUTE_MODULE

◆ EXECUTE_FILE

EXECUTE_FILE

◆ VERSION

VERSION

maxon:Url

Version mode