Commit 81c5a905 authored by Marco Rougeth's avatar Marco Rougeth Committed by Brett Cannon

bpo-36232: Improve error message on dbm.open() when the db doesn't exist (GH-12060)

parent 9bdd6d1c
...@@ -82,7 +82,8 @@ def open(file, flag='r', mode=0o666): ...@@ -82,7 +82,8 @@ def open(file, flag='r', mode=0o666):
# file doesn't exist and the new flag was used so use default type # file doesn't exist and the new flag was used so use default type
mod = _defaultmod mod = _defaultmod
else: else:
raise error[0]("need 'c' or 'n' flag to open new db") raise error[0]("db file doesn't exist; "
"use 'c' or 'n' flag to create a new db")
elif result == "": elif result == "":
# db type cannot be determined # db type cannot be determined
raise error[0]("db type could not be determined") raise error[0]("db type could not be determined")
......
Calling ``stop()`` on an unstarted or stopped :func:`unittest.mock.patch` Calling ``stop()`` on an unstarted or stopped :func:`unittest.mock.patch`
object will now return `None` instead of raising :exc:`RuntimeError`, object will now return `None` instead of raising :exc:`RuntimeError`,
making the method idempotent. making the method idempotent.
Patch byKarthikeyan Singaravelan. Patch by Karthikeyan Singaravelan.
Improve error message when trying to open existing DBM database that
actually doesn't exist. Patch by Marco Rougeth.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment