why does this hang

John Hunter jdhunter at nitace.bsd.uchicago.edu
Fri Aug 17 10:32:39 EDT 2001


Thanks for the test class; that was a good idea.  There is something
unusual about my date class in that it is a C++ date class that I use
a lot that I am exporting as a python extension using boost::python.
I don't have a lot of experience with python so I was not sure if the
problem was with the extension module or the python syntax.  Your code
indicates the former.

I did a lot more playing around last night and found some very odd
behavior.  For example, in the code below:

print 'today is %s' % d.get_mdy()  #mdy is month/day/year
print 'tomorrow is %s' % d.get_tomorrow().get_mdy()   #line1
print 'hour = %d' % d.get_hour()
print 'minute = %d' % d.get_minute()
print 'second = %d' % d.get_second()                  #line 2

The code would freeze if and only if both lines labeled line1 and
line2 were uncommented.  If I commented either or both, the code ran
fine.  When both were uncommented it had the same freezing behavior I
described in the OP (no Ctrl-C rescue).  I repeated this test several
times with identical results.

Now.  Each time the code froze, I copied the .py file to a suitably
named version like file1.hang.py, or if it ran I called it
file1.nohang.py.  That way I could compare exactly what was different
and could keep a record cause I was trying lots of things.  I came
back this morning and none of the code that was giving me troubles is
freezing!??  No reboot, no change in file contents.  So it looks like
the bug is random (except it sure was repeatable last night).

Has anyone experienced such weirdness with extension modules or
anything else before???

Thanks,
John Hunter



More information about the Python-list mailing list