Segmentation fault when loading object with slots
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I am getting a segmentation fault on line 472 of src/persistent/
This happened when I added a __slots__ declaration to a class. The segmentation fault occurs when an instance of this class is loaded from the object database. The problem goes away when i remove the slots declaration.
Inspection of cPersistence.c suggest the if statement on line 464 needs an else for when dict is null.
450 static PyObject *
451 pickle_
452 {
453 PyObject *slots=NULL;
454
455 if (PyTuple_
456 if (!PyArg_
457 return NULL;
458 }
459
460 if (state != Py_None) {
461 PyObject **dict;
462
463 dict = _PyObject_
464 if (dict) {
465 if (!*dict) {
466 *dict = PyDict_New();
467 if (!*dict)
468 return NULL;
469 }
470 }
471
472 if (*dict) {
473 PyDict_
474 if (PyDict_
475 return NULL;
476 }
The fix for this is comitted. Now, you'll get a type error in a situation like this.
The slot support in persistent is a bit brittle. If we're going to support slots, we need to do a lot more work.