#include <pytypes.h>
Public Member Functions | |
template<typename T > | |
T | cast () const |
template<> | |
void | cast () const |
bool | check () const |
const handle & | dec_ref () const & |
handle ()=default | |
The default constructor creates a handle with a nullptr -valued pointer. More... | |
handle (PyObject *ptr) | |
Creates a handle from the given raw Python object pointer. More... | |
const handle & | inc_ref () const & |
operator bool () const | |
Return true when the handle wraps a valid Python object. More... | |
bool | operator!= (const handle &h) const |
bool | operator== (const handle &h) const |
PyObject * | ptr () const |
Return the underlying PyObject * pointer. More... | |
PyObject *& | ptr () |
Protected Attributes | |
PyObject * | m_ptr = nullptr |
Holds a reference to a Python object (no reference counting)
The handle
class is a thin wrapper around an arbitrary Python object (i.e. a PyObject *
in Python's C API). It does not perform any automatic reference counting and merely provides a basic C++ interface to various Python API functions.
.. seealso:: The object
class inherits from handle
and adds automatic reference counting features.
|
default |
The default constructor creates a handle with a nullptr
-valued pointer.
|
inline |
T handle::cast | ( | ) | const |
|
inline |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |