resonance 1.0.1
Loading...
Searching...
No Matches
Py::PythonType Class Reference

Builder for the CPython type object of an extension type. More...

#include <pythontype.h>

Public Member Functions

 PythonType (int nBasicSize, int nItemSize)
 Allocate the type object and clear every slot but the size, the name, and the deallocator.
virtual ~PythonType ()
 Free the type object and the protocol tables.
PyTypeObject * type_object () const
 Read the type object.
void dealloc (destructor pfnDealloc)
 Set the deallocator.
void supportSequenceType ()
 Give the type the sequence protocol, once.
void supportMappingType ()
 Give the type the mapping protocol, once.
void supportBufferType ()
 Give the type the buffer protocol, once.

Detailed Description

Builder for the CPython type object of an extension type.

Its RTTI descriptor is at 0x0086f588. It has no base. Its accessor is at 0x005aba50, and the mangled name string sits at 0x00833400.

The object is 0x18 bytes, the five table pointers at +0x00 to +0x10 and the vptr after them at +0x14. The vtable at 0x008331e0 has two entries, the type function at 0x005aba50 and the destructor at 0x005ac220.

The constructor takes no type name, unlike released PyCXX's, and every type it builds is called unknown. The support setters that fill the protocol tables are outside this declaration.

Constructor & Destructor Documentation

◆ PythonType()

Py::PythonType::PythonType ( int nBasicSize,
int nItemSize )

Allocate the type object and clear every slot but the size, the name, and the deallocator.

Parameters
nBasicSizeThe instance size.
nItemSizeThe size of one variable-length item.
Ghidra address:
NTSC-U/C: 0x005ac120
Ghidra address:
PAL: 0x005ee648

◆ ~PythonType()

virtual Py::PythonType::~PythonType ( )
virtual

Free the type object and the protocol tables.

Ghidra address:
NTSC-U/C: 0x005ac220
Ghidra address:
PAL: 0x005ee748

Member Function Documentation

◆ type_object()

PyTypeObject * Py::PythonType::type_object ( ) const
inline

Read the type object.

Returns
The type object.
Ghidra address:
NTSC-U/C: 0x005ac298
Ghidra address:
PAL: 0x005ee7c0

◆ dealloc()

void Py::PythonType::dealloc ( destructor pfnDealloc)
inline

Set the deallocator.

Parameters
pfnDeallocThe deallocator.
Ghidra address:
NTSC-U/C: 0x005ac2c0
Ghidra address:
PAL: 0x005ee7e8

◆ supportSequenceType()

void Py::PythonType::supportSequenceType ( )

Give the type the sequence protocol, once.

The first call allocates the table, attaches it, and points its first seven entries at the Py::PythonExtensionBase handlers. The three entries after them remain unwritten.

Ghidra address:
NTSC-U/C: 0x005abf90
Ghidra address:
PAL: 0x005ee4b8

◆ supportMappingType()

void Py::PythonType::supportMappingType ( )

Give the type the mapping protocol, once.

Ghidra address:
NTSC-U/C: 0x005ac040
Ghidra address:
PAL: 0x005ee568

◆ supportBufferType()

void Py::PythonType::supportBufferType ( )

Give the type the buffer protocol, once.

The character buffer entry remains unwritten.

Ghidra address:
NTSC-U/C: 0x005ac0b0
Ghidra address:
PAL: 0x005ee5d8

The documentation for this class was generated from the following file: