Skip to content

Instantly share code, notes, and snippets.

@ivandeex
Last active August 29, 2015 14:25
Show Gist options
  • Save ivandeex/cfabc0da0eb2f964d993 to your computer and use it in GitHub Desktop.
Save ivandeex/cfabc0da0eb2f964d993 to your computer and use it in GitHub Desktop.
# method 1
import ctypes
obj = ctypes.cast(id(orig_obj), ctypes.py_object).value
# method 2
import gc
for obj in gc.get_objects():
if id(obj) == id_:
yield obj
else:
raise LookupError("No found")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment