[Python-Dev] possible bug in python importing pyc files

"Martin v. Löwis" martin at v.loewis.de
Tue Dec 1 19:12:32 CET 2009


> The code that shows this problem is owned by my company, I'm not sure
> if I would be able to produce it to create a bug report. But I do have some time
> to help debug the problem.
> 
> What steps should I take to try to isolate the problem?

Try isolating the precise instruction that behaves incorrectly (when the
.pyc is present). If you have already a failing test case, this should
be fairly easy to do. Some variable apparently has a value that it must
not have, or some operation yields a result that it must not yield. Find
out where it first behaves incorrectly in the failing case.

To do so, you may want to familiarize with pdb. Put

import pdb;pdb.set_trace()

into the failing test case, and try single-stepping through it. Make
sure stdin/stdout doesn't get redirected, since that confused pdb.

HTH,
Martin


More information about the Python-Dev mailing list