[New-bugs-announce] [issue40681] shelve.open() should accept pathlib.Path

Rémi Lapeyre report at bugs.python.org
Tue May 19 08:43:30 EDT 2020


New submission from Rémi Lapeyre <remi.lapeyre at henki.fr>:

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'
>>>

----------
components: Library (Lib)
messages: 369349
nosy: remi.lapeyre
priority: normal
severity: normal
status: open
title: shelve.open() should accept pathlib.Path
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40681>
_______________________________________


More information about the New-bugs-announce mailing list