diff options
author | Guido van Rossum <guido@python.org> | 2000-03-25 18:39:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-03-25 18:39:19 (GMT) |
commit | 13ff8eb4935ad426312f908beb1698abfac37cac (patch) | |
tree | c67550ac5912a34ba3a4c6d7471b23474ea18dcb /Objects | |
parent | d8855fde885ffcd9956352edb75674f38c64acaa (diff) | |
download | cpython-13ff8eb4935ad426312f908beb1698abfac37cac.zip cpython-13ff8eb4935ad426312f908beb1698abfac37cac.tar.gz cpython-13ff8eb4935ad426312f908beb1698abfac37cac.tar.bz2 |
Christian Tismer:
Added "better safe than sorry" patch to the new
trashcan code in object.c, to ensure that tstate
is not touched when it might be undefined.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c index d2aa542..ab10e3e 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -920,6 +920,9 @@ Py_ReprLeave(obj) CT 2k0309 modified to restore a possible error. + + CT 2k0325 + added better safe than sorry check for threadstate */ int _PyTrash_delete_nesting = 0; @@ -930,14 +933,17 @@ _PyTrash_deposit_object(op) PyObject *op; { PyObject *error_type, *error_value, *error_traceback; - PyErr_Fetch(&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); - PyErr_Restore(error_type, error_value, error_traceback); + if (PyThreadState_GET() != NULL) + PyErr_Restore(error_type, error_value, error_traceback); } void |