Having to "print" before method invocation?

Jeremy L. Moles jeremy at emperorlinux.com
Wed Mar 8 15:29:08 CET 2006

I have an object (written as part C extension, part pure Python) called
foo that I've been using without much fuss for a few months now.
However, in my latest project (a rather large one involving
multi-threading, pygtk, etc.), I'm seeing some really strange behavior
with a particular instance of my foo object.

About midway through my program, any attempt to use the instance fails;
however, if I add print statements before trying to invoke methods on
it, the foo object instance works fine.

I thought it might have something to do w/ reference counting, but
calling sys.getrefcount() shows sane values both before and after the
method call.

I know it's almost pointless to ask this question w/out showing any
code, but does anyone have any general ideas about what might make
something "invalid" unless you print it to stdout before using it?

More information about the Python-list mailing list