add Py_tp_finalize slot (closes #24345)

Patch from Petr Viktorin.
3 files changed