[Python-Dev] Crash in new "trashcan" mechanism.
Christian Tismer
tismer@tismer.com
Wed, 12 Apr 2000 15:00:39 +0200
Mark,
I know you are very busy. But I have no chance to build
a debug version, and probably there are more differences.
Can you perhaps try Vlad's patch?
and tell me if the outcome changes? This would give me
much more insight.
The change affects the macros and the function _PyTrash_deposit_object
which now must report an error via the return value.
The macro code should be:
#define Py_TRASHCAN_SAFE_BEGIN(op) \
{ \
++_PyTrash_delete_nesting; \
if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL || \
_PyTrash_deposit_object((PyObject*)op) != 0) { \
#define Py_TRASHCAN_SAFE_END(op) \
;} \
--_PyTrash_delete_nesting; \
if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \
_PyTrash_destroy_list(); \
} \
And the _PyTrash_deposit_object code should be (untested):
int
_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)
return PyList_Append(_PyTrash_delete_later, (PyObject *)op);
else
return -1;
if (PyThreadState_GET() != NULL)
PyErr_Restore(error_type, error_value, error_traceback);
return 0;
}
The result of this would be really enlighting :-)
ciao - chris
Vladimir Marangozov wrote:
>
> Of course, this
>
> Vladimir Marangozov wrote:
> >
> > to:
> >
> > #define Py_TRASHCAN_SAFE_BEGIN(op) \
> > { \
> > ++_PyTrash_delete_nesting; \
> > if (_PyTrash_delete_nesting >= PyTrash_UNWIND_LEVEL && \
> > _PyTrash_deposit_object((PyObject*)op) != 0) { \
> >
>
> was meant to be this:
>
> #define Py_TRASHCAN_SAFE_BEGIN(op) \
> { \
> ++_PyTrash_delete_nesting; \
> if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL || \
> _PyTrash_deposit_object((PyObject*)op) != 0) { \
>
> --
> Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr
> http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://www.python.org/mailman/listinfo/python-dev
--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net
14163 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today? http://www.stackless.com