Skip to content

Commit

Permalink
Early return in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
lysnikolaou committed Jan 27, 2025
1 parent 142c168 commit 49125a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pandas/_libs/internals.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,9 @@ cdef class BlockValuesRefs:
new_referenced_blocks = []
for ref in self.referenced_blocks:
status = PyWeakref_GetRef(ref, &pobj)
if status == 1:
if status == -1:
return
elif status == 1:
new_referenced_blocks.append(ref)
Py_DECREF(<object>pobj)
self.referenced_blocks = new_referenced_blocks
Expand Down

0 comments on commit 49125a6

Please sign in to comment.