Christian Tismer wrote:
About extensions and Trashcan. ... Or, I made a mistake in this little code:
void _PyTrash_deposit_object(op) PyObject *op; { PyObject *error_type, *error_value, *error_traceback;
if (PyThreadState_GET() != NULL) PyErr_Fetch(&error_type, &error_value, &error_traceback);
if (!_PyTrash_delete_later) _PyTrash_delete_later = PyList_New(0); if (_PyTrash_delete_later) PyList_Append(_PyTrash_delete_later, (PyObject *)op);
if (PyThreadState_GET() != NULL) PyErr_Restore(error_type, error_value, error_traceback); }
Maybe unrelated, but this code does not handle the case when PyList_Append fails. If it fails, the object needs to be deallocated as usual. Looking at the macros, I don't see how you can do that because Py_TRASHCAN_SAFE_END, which calls the above function, occurs after the finalization code... -- Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252