Slide 44
Slide 44 text
static PyObject* replace_type(PyObject* self, PyObject*
args){
PyTypeObject* fst;
PyTypeObject* snd;
if(!PyArg_UnpackTuple(args, "ref", 2,2, &fst, &snd))
{
return PyUnicode_FromString("failed unpack");
}
PyTypeObject* old_fst =
PyObject_GC_New(PyTypeObject, &PyType_Type);
// MEMORY LEAK HERE, this is a const char*
copy_old(tp_name);
copy_old(tp_basicsize);
copy_old(tp_itemsize);
[…]