summaryrefslogtreecommitdiffstats
path: root/Modules/_dbmmodule.c
diff options
context:
space:
mode:
authorZsolt Cserna <cserna.zsolt@gmail.com>2018-09-27 19:54:34 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2018-09-27 19:54:34 (GMT)
commit9df346bf98069a87de14a3c2f69009d800994c63 (patch)
treea05c995a24c0182d60b80eebbe0009dcd506117e /Modules/_dbmmodule.c
parent59ee5b12938efbf534f2a19300a847bf6b23a77d (diff)
downloadcpython-9df346bf98069a87de14a3c2f69009d800994c63.zip
cpython-9df346bf98069a87de14a3c2f69009d800994c63.tar.gz
cpython-9df346bf98069a87de14a3c2f69009d800994c63.tar.bz2
bpo-34248: Add filename to error raised in {gnu,ndbm}.open() (GH-8590)
Report the filename to the exception when raising {gdbm,dbm.ndbm}.error in dbm.gnu.open() and dbm.ndbm.open() functions, so it gets printed when the exception is raised, and can also be obtained by the filename attribute of the exception object.
Diffstat (limited to 'Modules/_dbmmodule.c')
-rw-r--r--Modules/_dbmmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 65761d8..081184a 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -62,7 +62,7 @@ newdbmobject(const char *file, int flags, int mode)
dp->di_size = -1;
/* See issue #19296 */
if ( (dp->di_dbm = dbm_open((char *)file, flags, mode)) == 0 ) {
- PyErr_SetFromErrno(DbmError);
+ PyErr_SetFromErrnoWithFilename(DbmError, file);
Py_DECREF(dp);
return NULL;
}