MCPcopy Create free account
hub / github.com/apache/arrow / _break_traceback_cycle_from_frame

Function _break_traceback_cycle_from_frame

python/pyarrow/util.py:210–230  ·  view source on GitHub ↗
(frame)

Source from the content-addressed store, hash-verified

208
209
210def _break_traceback_cycle_from_frame(frame):
211 # Clear local variables in all inner frames, so as to break the
212 # reference cycle.
213 this_frame = sys._getframe(0)
214 refs = gc.get_referrers(frame)
215 while refs:
216 for frame in refs:
217 if frame is not this_frame and isinstance(frame, types.FrameType):
218 break
219 else:
220 # No frame found in referrers (finished?)
221 break
222 refs = None
223 # Clear the frame locals, to try and break the cycle (it is
224 # somewhere along the chain of execution frames).
225 frame.clear()
226 # To visit the inner frame, we need to find it among the
227 # referrers of this frame (while `frame.f_back` would let
228 # us visit the outer frame).
229 refs = gc.get_referrers(frame)
230 refs = frame = this_frame = None
231
232
233def _download_urllib(url, out_path):

Callers 1

test_signal_refcycleFunction · 0.90

Calls 1

clearMethod · 0.45

Tested by 1

test_signal_refcycleFunction · 0.72