def await_gc(obj, rc):
"""wait for refcount on an object to drop to an expected value
Necessary because of the zero-copy gc thread,
which can take some time to receive its DECREF message.
"""
for i in range(50):
# rc + 2 because of the refs in this function
if grc(obj) <= rc + 2:
return
time.sleep(0.05)
评论列表
文章目录