this & sizeof

The purpose

Py++ can expose a class sizeof and this pointer value to Python. I created this functionality without special purpose in mind.

Example

mb = module_builder_t( ... )
cls = mb.class_( <<<your class>>> )
cls.expose_this = True
cls.expose_sizeof = True

The Python class will contain two properties this and sizeof. The usage is pretty simple:

import ctypes
from <<<your module>>> import <<<your class>>> as data_t

d = data_t()
print d.this
print d.sizeof

Warning: I hope you know what you are doing, otherwise don’t blame me :-)