[issue39672] SIGSEGV crash on shutdown with shelve & c pickle

zd nex report at bugs.python.org
Fri Mar 20 02:57:26 EDT 2020


zd nex <zdnexnet at gmail.com> added the comment:

Hello,

so I was trying to figure out where actually is problem is. As I do not think it is in shelve itself. So I have made different method for __setitem__ on shelve and I have found that it is actually in pickle.dump >

Here is code which I have used

def __setitem__(self, key, value):
    if self.writeback:
        self.cache[key] = value
    f = BytesIO()
    print("set")
    p = pickle.Pickler(f, self._protocol)
    try: 
        print("before dumps - > crash",value)
        p.dump(value)
        print("after dump > will not be printed on crash")
    except Exception as e:
        print("error set",e)
    print("after dump",key)
    self.dict[key.encode(self.keyencoding)] = f.getvalue()
    print("saved")

When in this code user changes p.dump to another method cpython crash does not happen. Can you please try to see if it is like that?

----------
components: +Interpreter Core, ctypes

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39672>
_______________________________________


More information about the Python-bugs-list mailing list