[New-bugs-announce] [issue26370] shelve filename inconsistent between platforms
report at bugs.python.org
Tue Feb 16 09:02:05 EST 2016
New submission from Dima Tisnek:
shelve.open("foo.db") creates "foo.db" on Linux and "foo.db.db" on OSX.
Something to that extent is even documented:
"""d = shelve.open(filename) # open, with (g)dbm filename -- no suffix"""
"""As a side-effect, an extension may be added to the filename and more than one file may be created."""
Still, it's super-quirky, it's almost as if the message was "don't use shelve."
Some ways out:
* ValueError if "." in basename(filaneme) # a hammer
* ValueError if filename.endswith((".db", ".gdbm", ...)) # block only known extensions
* strip extension if it's known that underlying library is going to add it
* patch underlying library to always use filename verbatim
components: Extension Modules
title: shelve filename inconsistent between platforms
versions: Python 3.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce