summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-01-22 03:05:49 -0800
committerLarry Hastings <larry@hastings.org>2014-01-22 03:05:49 -0800
commit462582651c92dad3d0e50810075d53d4a04e2466 (patch)
tree8306867e6d7c27d4fda979bde24aef0869015abd /Modules
parent071baa63c4ea3a54a54d90b173dd777e08895976 (diff)
downloadcpython-git-462582651c92dad3d0e50810075d53d4a04e2466.tar.gz
Two minor Argument Clinic bugfixes: use the name of the class in the
docstring for __new__ and __init__, and always use "goto exit" instead of returning "NULL" for failure to parse (as _new__ and __init__ return ints).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_cursesmodule.c13
-rw-r--r--Modules/_dbmmodule.c9
-rw-r--r--Modules/_opcode.c8
-rw-r--r--Modules/_pickle.c8
-rw-r--r--Modules/zlibmodule.c9
5 files changed, 25 insertions, 22 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index a1dc9eb967..f81fabb09f 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -621,36 +621,37 @@ curses_window_addch(PyObject *self, PyObject *args)
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:addch", &ch))
- return NULL;
+ goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr))
- return NULL;
+ goto exit;
group_right_1 = 1;
break;
case 3:
if (!PyArg_ParseTuple(args, "iiO:addch", &x, &y, &ch))
- return NULL;
+ goto exit;
group_left_1 = 1;
break;
case 4:
if (!PyArg_ParseTuple(args, "iiOl:addch", &x, &y, &ch, &attr))
- return NULL;
+ goto exit;
group_right_1 = 1;
group_left_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
- return NULL;
+ goto exit;
}
return_value = curses_window_addch_impl(self, group_left_1, x, y, ch, group_right_1, attr);
+exit:
return return_value;
}
static PyObject *
curses_window_addch_impl(PyObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr)
-/*[clinic end generated code: checksum=b073327add8197b6ba7fb96c87062422c8312954]*/
+/*[clinic end generated code: checksum=53d44d79791b30950972b3256bdd464f7426bf82]*/
{
PyCursesWindowObject *cwself = (PyCursesWindowObject *)self;
int coordinates_group = group_left_1;
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index d027e1cfa9..24323aa0e3 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -300,25 +300,26 @@ dbm_dbm_get(PyObject *self, PyObject *args)
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "s#:get", &key, &key_length))
- return NULL;
+ goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "s#O:get", &key, &key_length, &default_value))
- return NULL;
+ goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "dbm.dbm.get requires 1 to 2 arguments");
- return NULL;
+ goto exit;
}
return_value = dbm_dbm_get_impl((dbmobject *)self, key, key_length, group_right_1, default_value);
+exit:
return return_value;
}
static PyObject *
dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, int group_right_1, PyObject *default_value)
-/*[clinic end generated code: checksum=2c3209571267017f1b9abbd19e1b521849fd5d4a]*/
+/*[clinic end generated code: checksum=ca8bf63ec226e71d3cf390749777f7d5b7361478]*/
{
datum dbm_key, val;
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index 2e8469933d..633c4f806c 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -42,16 +42,16 @@ _opcode_stack_effect(PyModuleDef *module, PyObject *args)
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "i:stack_effect", &opcode))
- return NULL;
+ goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "ii:stack_effect", &opcode, &oparg))
- return NULL;
+ goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "_opcode.stack_effect requires 1 to 2 arguments");
- return NULL;
+ goto exit;
}
_return_value = _opcode_stack_effect_impl(module, opcode, group_right_1, oparg);
if ((_return_value == -1) && PyErr_Occurred())
@@ -64,7 +64,7 @@ exit:
static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, int group_right_1, int oparg)
-/*[clinic end generated code: checksum=47e76ec27523da4ab192713642d32482cd743aa4]*/
+/*[clinic end generated code: checksum=58fb4f1b174fc92f783dc945ca712fb752a6c283]*/
{
int effect;
if (HAS_ARG(opcode)) {
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 36abfd1d93..35e372c45a 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -4044,7 +4044,7 @@ to map the new Python 3 names to the old module names used in Python
[clinic start generated code]*/
PyDoc_STRVAR(_pickle_Pickler___init____doc__,
-"__init__(file, protocol=None, fix_imports=True)\n"
+"Pickler(file, protocol=None, fix_imports=True)\n"
"This takes a binary file for writing a pickle data stream.\n"
"\n"
"The optional *protocol* argument tells the pickler to use the given\n"
@@ -4088,7 +4088,7 @@ exit:
static int
_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file, PyObject *protocol, int fix_imports)
-/*[clinic end generated code: checksum=10c8ea05194d08108471163d8202cf5e12975544]*/
+/*[clinic end generated code: checksum=d10dfb463511430b4faad9fca07627041a35b96e]*/
{
_Py_IDENTIFIER(persistent_id);
_Py_IDENTIFIER(dispatch_table);
@@ -6581,7 +6581,7 @@ string instances as bytes objects.
[clinic start generated code]*/
PyDoc_STRVAR(_pickle_Unpickler___init____doc__,
-"__init__(file, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n"
+"Unpickler(file, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n"
"This takes a binary file for reading a pickle data stream.\n"
"\n"
"The protocol version of the pickle is detected automatically, so no\n"
@@ -6628,7 +6628,7 @@ exit:
static int
_pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file, int fix_imports, const char *encoding, const char *errors)
-/*[clinic end generated code: checksum=6936e9188104e45b1b15e1c11fe77b3965409471]*/
+/*[clinic end generated code: checksum=eb1a2cfc7b6f97c33980cff3d3b97d184a382f02]*/
{
_Py_IDENTIFIER(persistent_load);
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index efa95e996a..3894296b1f 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -205,19 +205,20 @@ zlib_compress(PyModuleDef *module, PyObject *args)
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "y*:compress", &bytes))
- return NULL;
+ goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "y*i:compress", &bytes, &level))
- return NULL;
+ goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "zlib.compress requires 1 to 2 arguments");
- return NULL;
+ goto exit;
}
return_value = zlib_compress_impl(module, &bytes, group_right_1, level);
+exit:
/* Cleanup for bytes */
if (bytes.obj)
PyBuffer_Release(&bytes);
@@ -227,7 +228,7 @@ zlib_compress(PyModuleDef *module, PyObject *args)
static PyObject *
zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int group_right_1, int level)
-/*[clinic end generated code: checksum=66c4d16d0b8b9dd423648d9ef00d6a89d3363665]*/
+/*[clinic end generated code: checksum=74648f97e6b9d3cc9cd568d47262d462bded7ed0]*/
{
PyObject *ReturnVal = NULL;
Byte *input, *output = NULL;