summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_dbmmodule.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/_dbmmodule.c.h')
-rw-r--r--Modules/clinic/_dbmmodule.c.h42
1 files changed, 39 insertions, 3 deletions
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
index c090862..e54c69c 100644
--- a/Modules/clinic/_dbmmodule.c.h
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -132,13 +132,49 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
const char *flags = "r";
int mode = 438;
- if (!_PyArg_ParseStack(args, nargs, "U|si:open",
- &filename, &flags, &mode)) {
+ if (!_PyArg_CheckPositional("open", nargs, 1, 3)) {
goto exit;
}
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("open", 1, "str", args[0]);
+ goto exit;
+ }
+ if (PyUnicode_READY(args[0]) == -1) {
+ goto exit;
+ }
+ filename = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("open", 2, "str", args[1]);
+ goto exit;
+ }
+ Py_ssize_t flags_length;
+ flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length);
+ if (flags == NULL) {
+ goto exit;
+ }
+ if (strlen(flags) != (size_t)flags_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (nargs < 3) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[2]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
return_value = dbmopen_impl(module, filename, flags, mode);
exit:
return return_value;
}
-/*[clinic end generated code: output=e4585e78f5821b5b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7f5d30ef5d820b8a input=a9049054013a1b77]*/