Xavier de Gaye added the comment: The lazycache() function of the linecache module meets your request, I think. See the following debugging session using the attached script:
$ python -m pdb debug_script.py > /path/to/cwd/debug_script.py(1)<module>() -> def debug_script(script): (Pdb) n > /path/to/cwd/debug_script.py(19)<module>() -> """ (Pdb) n > /path/to/cwd/debug_script.py(20)<module>() -> code, globs = debug_script(s) (Pdb) n > /path/to/cwd/debug_script.py(21)<module>() -> exec(code, globs) (Pdb) s --Call-- > /path/to/cwd/script_name(2)<module>() -> x = 1 (Pdb) s > /path/to/cwd/script_name(2)<module>() -> x = 1 (Pdb) s > /path/to/cwd/script_name(3)<module>() -> y = 'blabla' (Pdb) s --Return-- > /path/to/cwd/script_name(3)<module>()->None -> y = 'blabla' (Pdb) s --Return-- > /path/to/cwd/debug_script.py(21)<module>()->None -> exec(code, globs) (Pdb) ---------- nosy: +xdegaye Added file: http://bugs.python.org/file45358/debug_script.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28610> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com