igo95862 <igo9...@gmail.com> added the comment:

I found out that you can call the type as an object in order to create new 
object.


Example:


SdBusMessageObject *new_message_object = (SdBusMessageObject 
*)PyObject_Call((PyObject *)&SdBusMessageType, dummy_tuple, dummy_dict);


This is somewhat not documented. Is this the recommended way to allocate object 
on heap?


I also found out that if you create a custom .tp_free function for the type it 
must call PyObject_Free(self); otherwise you leak memory.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42292>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to