MCPcopy Create free account
hub / github.com/ipython/ipython / update_instances

Function update_instances

IPython/extensions/autoreload.py:271–280  ·  view source on GitHub ↗

Use garbage collector to find all instances that refer to the old class definition and update their __class__ to point to the new class definition

(old, new)

Source from the content-addressed store, hash-verified

269
270
271def update_instances(old, new):
272 """Use garbage collector to find all instances that refer to the old
273 class definition and update their __class__ to point to the new class
274 definition"""
275
276 refs = gc.get_referrers(old)
277
278 for ref in refs:
279 if type(ref) is old:
280 ref.__class__ = new
281
282
283def update_class(old, new):

Callers 1

update_classFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected