Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-39421: Fix posible crash in heapq with custom comparison operators #18118
Conversation
import heapq
class h(int):
def __lt__(self, o):
list2.clear()
return NotImplemented
class g(int):
def __lt__(self, o):
list1.clear()
return NotImplemented
list1, list2 = [], []
heapq.heappush(list1, h(0))
heapq.heappush(list2, g(0))
print(list1)
print(list2)
heapq.heappush(list1, g(1))
heapq.heappush(list2, h(1))
print(list1)
print(list2) This PR does not fix this case. Please take a look |
…perators
This comment has been minimized.
This comment has been minimized.
Thanks! I added a test in 9718f66 |
…rison operators
LGTM Just comment: e.g. Py_INCREF(a, b, c...); Py_DECREF(a, b, c...); |
This comment has been minimized.
This comment has been minimized.
We would need a different function as C does not allow overloads (for |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This should be backported to all branches that are still doing security releases. |
79f89e6
into
python:master
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
Jan 23, 2020
Thanks @pablogsal for the PR |
pythonGH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
pythonGH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 23, 2020
GH-18145 is a backport of this pull request to the 3.7 branch. |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 23, 2020
GH-18144 is a backport of this pull request to the 3.8 branch. |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 23, 2020
GH-18146 is a backport of this pull request to the 3.6 branch. |
pythonGH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
GH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
Jan 23, 2020
Thanks @pablogsal for the PR |
pythonGH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 23, 2020
GH-18149 is a backport of this pull request to the 3.8 branch. |
GH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
pablogsal commentedJan 22, 2020
•
edited by bedevere-bot
https://bugs.python.org/issue39421