diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-03 20:53:51 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-03 20:53:51 (GMT) |
commit | 1009bf18b38a8d36298575191dd8fdf43f8f9097 (patch) | |
tree | 18860fdef30c931dc2ea177059e96b69a49fa04f /Modules/_dbmmodule.c | |
parent | 0759f84d6260bad1234b802212e73fdc5873d261 (diff) | |
download | cpython-1009bf18b38a8d36298575191dd8fdf43f8f9097.zip cpython-1009bf18b38a8d36298575191dd8fdf43f8f9097.tar.gz cpython-1009bf18b38a8d36298575191dd8fdf43f8f9097.tar.bz2 |
Issue #23501: Argumen Clinic now generates code into separate files by default.
Diffstat (limited to 'Modules/_dbmmodule.c')
-rw-r--r-- | Modules/_dbmmodule.c | 74 |
1 files changed, 4 insertions, 70 deletions
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c index 93ea416..c017885 100644 --- a/Modules/_dbmmodule.c +++ b/Modules/_dbmmodule.c @@ -40,6 +40,8 @@ typedef struct { DBM *di_dbm; } dbmobject; +#include "clinic/_dbmmodule.c.h" + static PyTypeObject Dbmtype; #define is_dbmobject(v) (Py_TYPE(v) == &Dbmtype) @@ -277,39 +279,9 @@ dbm.dbm.get Return the value for key if present, otherwise default. [clinic start generated code]*/ -PyDoc_STRVAR(dbm_dbm_get__doc__, -"get($self, key, default=None, /)\n" -"--\n" -"\n" -"Return the value for key if present, otherwise default."); - -#define DBM_DBM_GET_METHODDEF \ - {"get", (PyCFunction)dbm_dbm_get, METH_VARARGS, dbm_dbm_get__doc__}, - -static PyObject * -dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, PyObject *default_value); - -static PyObject * -dbm_dbm_get(dbmobject *dp, PyObject *args) -{ - PyObject *return_value = NULL; - const char *key; - Py_ssize_clean_t key_length; - PyObject *default_value = Py_None; - - if (!PyArg_ParseTuple(args, - "s#|O:get", - &key, &key_length, &default_value)) - goto exit; - return_value = dbm_dbm_get_impl(dp, key, key_length, default_value); - -exit: - return return_value; -} - static PyObject * dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, PyObject *default_value) -/*[clinic end generated code: output=452ea11394e7e92d input=aecf5efd2f2b1a3b]*/ +/*[clinic end generated code: output=c2bdccaa734ad349 input=aecf5efd2f2b1a3b]*/ { datum dbm_key, val; @@ -449,47 +421,9 @@ Return a database object. [clinic start generated code]*/ -PyDoc_STRVAR(dbmopen__doc__, -"open($module, filename, flags=\'r\', mode=0o666, /)\n" -"--\n" -"\n" -"Return a database object.\n" -"\n" -" filename\n" -" The filename to open.\n" -" flags\n" -" How to open the file. \"r\" for reading, \"w\" for writing, etc.\n" -" mode\n" -" If creating a new file, the mode bits for the new file\n" -" (e.g. os.O_RDWR)."); - -#define DBMOPEN_METHODDEF \ - {"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__}, - -static PyObject * -dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode); - -static PyObject * -dbmopen(PyModuleDef *module, PyObject *args) -{ - PyObject *return_value = NULL; - const char *filename; - const char *flags = "r"; - int mode = 438; - - if (!PyArg_ParseTuple(args, - "s|si:open", - &filename, &flags, &mode)) - goto exit; - return_value = dbmopen_impl(module, filename, flags, mode); - -exit: - return return_value; -} - static PyObject * dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode) -/*[clinic end generated code: output=9a7b725f9c4dcec2 input=6499ab0fab1333ac]*/ +/*[clinic end generated code: output=8b618fe06b92bf86 input=6499ab0fab1333ac]*/ { int iflags; |