This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: shelve filename inconsistent between platforms
Type: enhancement Stage:
Components: Extension Modules Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Dima.Tisnek, SilentGhost, georg.brandl
Priority: normal Keywords:

Created on 2016-02-16 14:02 by Dima.Tisnek, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg260362 - (view) Author: Dima Tisnek (Dima.Tisnek) * Date: 2016-02-16 14:02
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"""
and
"""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
msg260476 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2016-02-18 18:55
Would you like to try to submit a patch for a solution you think most appropriate?
History
Date User Action Args
2022-04-11 14:58:27adminsetgithub: 70558
2016-02-18 18:55:32SilentGhostsetversions: + Python 3.6, - Python 3.5
nosy: + georg.brandl, SilentGhost

messages: + msg260476

type: behavior -> enhancement
2016-02-16 14:02:05Dima.Tisnekcreate