Having to "print" before method invocation?



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?

.



Relevant Pages

  • Re: bug with isinstance() ?
    ... This is a recipe for confusing ... indirectly via a second file. ... print id(Foo), Foo ... Yes, the ambiguity of Foo, which the print statements should reveal. ...
    (comp.lang.python)
  • Help Regarding memory leak detection.
    ... memory leaks from my program. ... deletefoo; ... Ideally first time i should not get any memory leak. ... above code all print statements are executed. ...
    (microsoft.public.vc.mfc)