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.open() should accept pathlib.Path
Type: behavior Stage: resolved
Components: Library (Lib) Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Support pathlike objects on dbm/shelve
View: 40563
Assigned To: Nosy List: BTaskaya, remi.lapeyre
Priority: normal Keywords:

Created on 2020-05-19 12:43 by remi.lapeyre, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg369349 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2020-05-19 12:43
This should target Python3.10, current behavior is:

Python 3.10.0a0 (heads/master:19e3e00264, May 19 2020, 14:40:31) 
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shelve, pathlib
>>> shelve.open(pathlib.Path('spam'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/remi/src/cpython/Lib/shelve.py", line 243, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/Users/remi/src/cpython/Lib/shelve.py", line 227, in __init__
    Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
  File "/Users/remi/src/cpython/Lib/dbm/__init__.py", line 78, in open
    result = whichdb(file) if 'n' not in flag else None
  File "/Users/remi/src/cpython/Lib/dbm/__init__.py", line 113, in whichdb
    f = io.open(filename + ".pag", "rb")
TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'
>>>
msg369350 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2020-05-19 12:44
Duplicate of bpo-40563
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84858
2020-05-19 12:59:19serhiy.storchakasetstatus: open -> closed
resolution: duplicate
superseder: Support pathlike objects on dbm/shelve
stage: resolved
2020-05-19 12:44:58BTaskayasetnosy: + BTaskaya
messages: + msg369350
2020-05-19 12:43:30remi.lapeyrecreate