[issue38864] dbm: Can't open database with bytes-encoded filename

2019-11-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Low level functions inthe os module support both str and bytes paths (they support also path-like objects and often support open file descriptors). But high level functions support only str and maybe path-like objects. Use os.fsdecode if you need to conver

[issue38864] dbm: Can't open database with bytes-encoded filename

2019-11-20 Thread John Goerzen
John Goerzen added the comment: As has been pointed out to me, the surrogateescape method could be used here; however, it is a bit of an odd duckling itself, and the system's open() call accepts bytes; couldn't this as well? -- ___ Python tracker

[issue38864] dbm: Can't open database with bytes-encoded filename

2019-11-20 Thread John Goerzen
New submission from John Goerzen : This simple recipe fails: >>> import dbm >>> dbm.open(b"foo") Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.7/dbm/__init__.py", line 78, in open result = whichdb(file) if 'n' not in flag else None File "/usr/lib/pytho