I suspect integrating this feature (let's call it sys._current_frames() for the sake of argument, although it probably belongs in the threads module) in the core is not going to be quite as trivial as you say, as there are potential memory leaks. If the function returns a dictionary, it should probably be a weak dict to avoid a circular reference between the frame of the thread that calls _current_frames and its locals that contain the returned dictionary.
Given the primary use case as a debugging tool, I don't think the circularity will have any significant problems. It would be simpler to just document that a caller should do this:
try: framedict = sys._current_frames() # do stuff here finally: framedict = None # break the cycle, allowing GC
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com