Make db modules' error classes inherit IOError.
Stop dbm from importing every dbm module when imported.
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index ddfd4cd..7e80381 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -401,7 +401,8 @@
return;
d = PyModule_GetDict(m);
if (DbmError == NULL)
- DbmError = PyErr_NewException("_dbm.error", NULL, NULL);
+ DbmError = PyErr_NewException("_dbm.error",
+ PyExc_IOError, NULL);
s = PyUnicode_FromString(which_dbm);
if (s != NULL) {
PyDict_SetItemString(d, "library", s);
diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c
index 6c75819..abc8837 100644
--- a/Modules/_gdbmmodule.c
+++ b/Modules/_gdbmmodule.c
@@ -523,7 +523,7 @@
if (m == NULL)
return;
d = PyModule_GetDict(m);
- DbmError = PyErr_NewException("_gdbm.error", NULL, NULL);
+ DbmError = PyErr_NewException("_gdbm.error", PyExc_IOError, NULL);
if (DbmError != NULL) {
PyDict_SetItemString(d, "error", DbmError);
s = PyUnicode_FromString(dbmmodule_open_flags);