105 return pyob !=
nullptr;
167 return PyTuple_Check(
mPtr);
178 return PyList_Check(
mPtr);
215 void set(PyObject *pyob) {
242 if (PyErr_Occurred() !=
nullptr) {
258 PyObject *pyob =
object.mPtr;
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Root of the PyCXX exception hierarchy.
Definition exception.h:19
Reference-counted handle on any Python object, and the root of the PyCXX object hierarchy.
Definition object.h:42
String str() const
Produce the text of str() applied to the object.
Object getAttr(const HxStr &name) const
Read one attribute.
Type type() const
Produce the object's type.
HxStr as_string() const
Produce the text of str() applied to the object, as a game string.
virtual ~Object()
Release the reference.
Definition object.h:78
bool isList() const
Report whether the object is a list.
Definition object.h:177
void set(PyObject *pyob)
Replace the reference with a borrowed one and add a count of its own.
Definition object.h:215
Object(PyObject *pyob=Py_None)
Take a borrowed reference and add a count of its own.
Definition object.h:52
bool isType(const Type &type) const
Report whether the object's type is a given type.
bool isTuple() const
Report whether the object is a tuple.
Definition object.h:166
Object(const Object &other)
Copy another handle and add a count of its own.
Definition object.h:67
void release()
Release the reference and empty the handle.
Definition object.h:200
void validate()
Enforce this type's accepts() test on the stored reference.
Definition object.h:237
PyObject * mPtr
Wrapped reference, null only between release() and the next assignment.
Definition object.h:191
Object & operator=(const Object &other)
Replace the reference with another handle's.
Definition object.h:88
virtual bool accepts(PyObject *pyob) const
Whether a reference is acceptable for this handle's type.
Definition object.h:104
Handle on a Python string.
Definition string.h:34
Exception for a value of the wrong Python type, mirroring Python's TypeError.
Definition typeerror.h:21
Handle on a Python type object.
Definition type.h:22
Configuration header of the PyCXX binding layer.
C++ wrappers for the embedded Python interpreter's objects, types, and extension modules.
Definition attributeerror.h:7
PyObject * new_reference_to(const Object &object)
Produce an owned reference from a handle, for returning to the interpreter.
Definition object.h:257