Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ msiobj_dealloc(msiobj* msidb)
{
MsiCloseHandle(msidb->h);
msidb->h = 0;
PyObject_Del(msidb);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that calling PyObject_Del() in dealloc is correct. Maybe you should call Py_TYPE(op)->tp_free(op); instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation of tp_dealloc() (https://docs.python.org/3.7/c-api/typeobj.html#c.PyTypeObject.tp_dealloc):

If the type is not subtypable (doesn’t have the Py_TPFLAGS_BASETYPE flag bit set), it is permissible to call the object deallocator directly instead of via tp_free.

As none of the four types in _msi.c set a tp_free() function, it is correct to call PyObject_Del() here (this is done by many other types).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok. I checked and you are right: range_dealloc() also calls PyObject_Del() for example.

I forgot that PyObject_Del() is simply an alias to PyObject_Free(), a memory deallocator.

}

static PyObject*
Expand Down