Andrei Daraschenka <dorosch.github...@yandex.ru> added the comment:

Hello zd nex

After a little research, it became clear that this drop is due to vague garbage 
collection behavior. As you know, method `__del__` is called by the garbage 
collector and when this happens there is no guarantee that the rest of the 
objects are not yet cleaned.

    def __del__(self):
        if not hasattr(self, 'writeback'):
            return
        self.close()

But in the `close` method, synchronization with the disk occurred and objects 
were created for modules that were no longer in memory and, as a result, method 
`dump` fell with an error, because when trying to get module `pickle` it was 
already gone (due to the garbage collector).

Modules/_pickle.c
....
4353     PickleState *st = _Pickle_GetGlobalState();
....

But `_Pickle_GetGlobalState` can't return right result because pickle module 
was gone from memory by garbage collector.

In this case, you encountered a problem when the C code tried to use a module 
that was no longer in memory since this module deleted the garbage collector.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39672>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to