problem with extending python with C

LAMY Bertrand b_lamy at club-internet.fr
Mon Sep 17 02:15:46 EDT 2001


[PS : thanks for the last answer, there was a perfidious bug in my
code...]

now I've got another problem. I got a segfault at the end of my program,
after python has destroyed all the objects (I know that because I've put
a printf in the dealloc functions. so this is not very important since
it crashes only at termination). I got the segfault in that case :
- I've got 2 type object defined in C (if 1 of the 2 is defined in
Python, it won't crash) : one is a carrier which a Pyobject* (given at
creation, the carrier Py_INCREF the PyObject given and Py_DECREF it at
deallocation), the second is a carried (handled by the carrier of course
:)
- The carrier have an attribute that return the carried
- After creating a carrier containing a carried, I ask the carrier to
print the object carried

Some precisions :
- I don't have 100% crashes
- it seems that the crash occurs only when sizeof(carried) >= 40
- I have Python 2.2a3 and work under Linux

I've done the minimal code to get the crash, if someone is interested
(?), I can send it (I cannot manage to send the file attached with this
mail, sorry)

This bug is quite strange and I wonder if my code is responsible or not
?

thanks

-Blam



More information about the Python-list mailing list