extmod/uasyncio: Make Python Task match C version with use of asserts.

This helps to catch bugs when a Task is put on more than one pairing heap.

Signed-off-by: Damien George <damien@micropython.org>
pull/8571/head
Damien George 2022-04-21 13:17:33 +10:00
rodzic 8631753ff4
commit f7454f850f
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -100,10 +100,10 @@ class TaskQueue:
return self.heap
def push_sorted(self, v, key):
assert v.ph_child is None
assert v.ph_next is None
v.data = None
v.ph_key = key
v.ph_child = None
v.ph_next = None
self.heap = ph_meld(v, self.heap)
def push_head(self, v):
@ -111,7 +111,9 @@ class TaskQueue:
def pop_head(self):
v = self.heap
self.heap = ph_pairing(self.heap.ph_child)
assert v.ph_next is None
self.heap = ph_pairing(v.ph_child)
v.ph_child = None
return v
def remove(self, v):