New submission from gardener.willy <gardener.wi...@yandex.ru>:
Shelve module uses "import dbm" instruction while opening database. Dbm module has global dictionary "_modules". This dictionary modifies during database opening operation. When different threads simultaneously try to open different databases, unexpected behavior occurred. In my case I've got such message: with shelve.open('some_file') as f: File "/usr/local/lib/python3.6/shelve.py", line 243, in open return DbfilenameShelf(filename, flag, protocol, writeback) File "/usr/local/lib/python3.6/shelve.py", line 227, in init Shelf.init(self, dbm.open(filename, flag), protocol, writeback) File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open return mod.open(file, flag, mode) AttributeError: module 'dbm.ndbm' has no attribute 'open' Behavior is the same on python 3.6 and 3.7. Error is spontaneous. ---------- components: Library (Lib) messages: 383229 nosy: gardener.willy priority: normal severity: normal status: open title: shelve module is not thread-safe during accessing different databases from different threads type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42667> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com