mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
bpo-31095: fix potential crash during GC (GH-2974)
This commit is contained in:
parent
bf9075a0c5
commit
a6296d34a4
14 changed files with 60 additions and 13 deletions
|
@ -655,7 +655,8 @@ py_encode_basestring(PyObject* self UNUSED, PyObject *pystr)
|
|||
static void
|
||||
scanner_dealloc(PyObject *self)
|
||||
{
|
||||
/* Deallocate scanner object */
|
||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||
PyObject_GC_UnTrack(self);
|
||||
scanner_clear(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
@ -1778,7 +1779,8 @@ bail:
|
|||
static void
|
||||
encoder_dealloc(PyObject *self)
|
||||
{
|
||||
/* Deallocate Encoder */
|
||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||
PyObject_GC_UnTrack(self);
|
||||
encoder_clear(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue