Author numerodix
Recipients ncoghlan, numerodix, ronaldoussoren, sptonkin
Date 2013-10-20.17:50:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382291413.95.0.777495517882.issue18401@psf.upfronthosting.co.za>
In-reply-to
Content
I have been thinking about a fix for this. A straightforward fix would be to add a kwarg readrc=True to the constructor of Pdb that will default to reading the rc files as it does now, and allows disabling this default. 

The implication is that all tests in stdlib will need to use pdb.Pdb(readrc=False).set_trace() instead of just pdb.set_trace(). This would impact (from what I can see) doctest.py, test_pdb.py and test_doctest.py, and would also require some kind of warning/notice instructing test writers to follow this convention.

I started working on a patch for this (attached), which works for test_pdb, but I can't get the tests in test_doctest to work yet.


It would also be useful to have a test that demonstrates this problem and I'm not sure what the best approach is... should it show that doctests fail? If so, and knowing that Pdb reads rc files from a) $HOME/.pdbrc and b) ./.pdbrc, the test could:
a) unset os.environ['HOME']
b) use a tmpdir and put a temporary .pdbrc file there, with some invalid Python code
c) chdir to that tmpdir

Then to trigger the problem it could write a small script containing a doctest that internally does pdb.set_trace(), run the module and demonstrate that the doctest failed. And then teardown all the temporary resources in a finally block.
History
Date User Action Args
2013-10-20 17:50:13numerodixsetrecipients: + numerodix, ronaldoussoren, ncoghlan, sptonkin
2013-10-20 17:50:13numerodixsetmessageid: <1382291413.95.0.777495517882.issue18401@psf.upfronthosting.co.za>
2013-10-20 17:50:13numerodixlinkissue18401 messages
2013-10-20 17:50:13numerodixcreate