Skip to content

Commit 75a1d3a

Browse files
committed
gh-116738: Address the review comments
1 parent a22da8f commit 75a1d3a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/test/test_free_threading/test_heapq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_racing_heapreplace(self):
8888

8989
def heapreplace_func(heap, replace_items):
9090
for item in replace_items:
91-
popped_item = heapq.heapreplace(heap, item)
91+
heapq.heapreplace(heap, item)
9292

9393
self.run_concurrently(
9494
worker_func=heapreplace_func,
@@ -165,7 +165,7 @@ def test_racing_heapreplace_max(self):
165165

166166
def heapreplace_max_func(max_heap, replace_items):
167167
for item in replace_items:
168-
popped_item = heapq.heapreplace_max(max_heap, item)
168+
heapq.heapreplace_max(max_heap, item)
169169

170170
self.run_concurrently(
171171
worker_func=heapreplace_max_func,

Modules/_heapqmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ _heapq_heappush_impl(PyObject *module, PyObject *heap, PyObject *item)
133133
{
134134
// In a free-threaded build, the heap is locked at this point.
135135
// Therefore, calling _PyList_AppendTakeRef() is safe and no overhead.
136-
if (_PyList_AppendTakeRef((PyListObject *)heap, Py_NewRef(item)))
136+
if (_PyList_AppendTakeRef((PyListObject *)heap, Py_XNewRef(item)))
137137
return NULL;
138138

139139
if (siftdown((PyListObject *)heap, 0, PyList_GET_SIZE(heap)-1))
@@ -504,7 +504,7 @@ _heapq_heappush_max_impl(PyObject *module, PyObject *heap, PyObject *item)
504504
{
505505
// In a free-threaded build, the heap is locked at this point.
506506
// Therefore, calling _PyList_AppendTakeRef() is safe and no overhead.
507-
if (_PyList_AppendTakeRef((PyListObject *)heap, Py_NewRef(item))) {
507+
if (_PyList_AppendTakeRef((PyListObject *)heap, Py_XNewRef(item))) {
508508
return NULL;
509509
}
510510

0 commit comments

Comments
 (0)