summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_gdbmmodule.c.h
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2023-07-23 13:51:12 (GMT)
committerGitHub <noreply@github.com>2023-07-23 13:51:12 (GMT)
commitb273837fea129df8477da557ad3cb23a0ed12c20 (patch)
treeb633c744e9f4711edefef7ab56a12aa6ce57483f /Modules/clinic/_gdbmmodule.c.h
parente59da0c4f283b966ccb175fb94460f58211a9704 (diff)
downloadcpython-b273837fea129df8477da557ad3cb23a0ed12c20.zip
cpython-b273837fea129df8477da557ad3cb23a0ed12c20.tar.gz
cpython-b273837fea129df8477da557ad3cb23a0ed12c20.tar.bz2
gh-107122: Add clear method to dbm.gdbm.module (gh-107127)
Diffstat (limited to 'Modules/clinic/_gdbmmodule.c.h')
-rw-r--r--Modules/clinic/_gdbmmodule.c.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
index 5c6aeee..76f6db3 100644
--- a/Modules/clinic/_gdbmmodule.c.h
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -247,6 +247,28 @@ _gdbm_gdbm_sync(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_s
return _gdbm_gdbm_sync_impl(self, cls);
}
+PyDoc_STRVAR(_gdbm_gdbm_clear__doc__,
+"clear($self, /)\n"
+"--\n"
+"\n"
+"Remove all items from the database.");
+
+#define _GDBM_GDBM_CLEAR_METHODDEF \
+ {"clear", _PyCFunction_CAST(_gdbm_gdbm_clear), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_clear__doc__},
+
+static PyObject *
+_gdbm_gdbm_clear_impl(gdbmobject *self, PyTypeObject *cls);
+
+static PyObject *
+_gdbm_gdbm_clear(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ if (nargs) {
+ PyErr_SetString(PyExc_TypeError, "clear() takes no arguments");
+ return NULL;
+ }
+ return _gdbm_gdbm_clear_impl(self, cls);
+}
+
PyDoc_STRVAR(dbmopen__doc__,
"open($module, filename, flags=\'r\', mode=0o666, /)\n"
"--\n"
@@ -322,4 +344,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=c6e721d82335adb3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8c613cbd88e57480 input=a9049054013a1b77]*/