threading.py Condition wait overflow error

Tim Peters tim.peters at gmail.com
Thu Jan 27 04:51:02 CET 2005


[Tim Peters]
...
>> The most common cause for "impossible exceptions"
>  is flawed C code in an extension that fails to
>> check a Python C API call for an error return.

[Mark English]
> Yes, I use a lot of C modules which I wrote.

Then you know where to start looking <wink>.

> It could certainly be one of them (although which one could be an
> interesting challenge to find out). It may even have something to do
> with moving to the VC7.1 compiler.

Hard to say in advance.  Since you have VC7.1, that opens a world of
possiblities if you recompile Python.  There are extra checks in
ceval.c in a debug build, trying to catch "a call lied about whether
it raised an exception" soon(er) after it happens.  Rebuilding all
your extensions in debug mode too could be a PITA, so you could get
the same effect by #define'ing CHECKEXC in a release build.  But a
debug build has all sorts of extra checks that can help, and you could
get into the debugger then and set a breakpoint on the unexpected
OverflowError ... a quick check of the source shows that "long int too
large to convert to int" is produced only by longobject.c's
PyLong_AsLong() function.  There's no way we _should_ be getting into
that function by applying min() to floats, of course.

> Thank you very much for your suggestion. Without it I would never have
> thought to look at that code.

Nobody ever does <wink>.



More information about the Python-list mailing list