@@ -34,6 +34,13 @@ class _queue.SimpleQueue "simplequeueobject *" "simplequeue_get_state_by_type(ty
34
34
[clinic start generated code]*/
35
35
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=0a4023fe4d198c8d]*/
36
36
37
+ static int
38
+ simplequeue_clear (simplequeueobject * self )
39
+ {
40
+ Py_CLEAR (self -> lst );
41
+ return 0 ;
42
+ }
43
+
37
44
static void
38
45
simplequeue_dealloc (simplequeueobject * self )
39
46
{
@@ -46,7 +53,7 @@ simplequeue_dealloc(simplequeueobject *self)
46
53
PyThread_release_lock (self -> lock );
47
54
PyThread_free_lock (self -> lock );
48
55
}
49
- Py_XDECREF ( self -> lst );
56
+ ( void ) simplequeue_clear ( self );
50
57
if (self -> weakreflist != NULL )
51
58
PyObject_ClearWeakRefs ((PyObject * ) self );
52
59
Py_TYPE (self )-> tp_free (self );
@@ -57,6 +64,7 @@ static int
57
64
simplequeue_traverse (simplequeueobject * self , visitproc visit , void * arg )
58
65
{
59
66
Py_VISIT (self -> lst );
67
+ Py_VISIT (Py_TYPE (self ));
60
68
return 0 ;
61
69
}
62
70
@@ -362,6 +370,7 @@ static PyType_Slot simplequeue_slots[] = {
362
370
{Py_tp_dealloc , simplequeue_dealloc },
363
371
{Py_tp_doc , (void * )simplequeue_new__doc__ },
364
372
{Py_tp_traverse , simplequeue_traverse },
373
+ {Py_tp_clear , simplequeue_clear },
365
374
{Py_tp_members , simplequeue_members },
366
375
{Py_tp_methods , simplequeue_methods },
367
376
{Py_tp_new , simplequeue_new },
0 commit comments