Skip to content

Commit 7b72978

Browse files
committed
CVE-2022-48560 Change code to be compatible with Python2
1 parent 7f60928 commit 7b72978

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Lib/test/test_heapq.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ def test_comparison_operator_modifiying_heap(self):
401401
# when comparing objects as they can alter the heap
402402
class EvilClass(int):
403403
def __lt__(self, o):
404-
heap.clear()
404+
# heap.clear()
405+
del heap[:]
405406
return NotImplemented
406407

407408
heap = []
@@ -412,12 +413,14 @@ def test_comparison_operator_modifiying_heap_two_heaps(self):
412413

413414
class h(int):
414415
def __lt__(self, o):
415-
list2.clear()
416+
# list2.clear()
417+
del list2[:]
416418
return NotImplemented
417419

418420
class g(int):
419421
def __lt__(self, o):
420-
list1.clear()
422+
# list1.clear()
423+
del list1[:]
421424
return NotImplemented
422425

423426
list1, list2 = [], []

0 commit comments

Comments
 (0)