New submission from Alexander Belopolsky <belopol...@users.sourceforge.net>:
With attached x.py: $ cat x.py """ >>> foo() """ def foo(): 1/0 if __name__ == '__main__': import doctest, pdb try: doctest.testmod(raise_on_error=True) except doctest.UnexpectedException, e: pdb.post_mortem(e.exc_info[2]) $ ./python.exe x.py > /Users/sasha/Work/python-svn/trunk/x.py(5)foo() -> 1/0 (Pdb) up > <doctest __main__[0]>(1)<module>() (Pdb) l [EOF] Apparently the problem is that the default getlines gets restored in the "finally:" section in DocTestRunner.run() before post_mortem is invoked. The only solution that comes to mind is to patch pdb.post_mortem similarly to the way pdb.set_trace is patched but not restore it until the end of testmod(). Am I missing a simpler solution? ---------- files: x.py messages: 79787 nosy: belopolsky severity: normal status: open title: Pdb cannot access doctest source in postmortem Added file: http://bugs.python.org/file12727/x.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4938> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com