mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
Use PyArg_UnpackTuple() where possible.
This commit is contained in:
parent
1b6f7a9057
commit
1761a7cc8b
1 changed files with 4 additions and 4 deletions
|
@ -300,7 +300,7 @@ dialect_init(DialectObj * self, PyObject * args, PyObject * kwargs)
|
||||||
self->doublequote = 1;
|
self->doublequote = 1;
|
||||||
self->strict = 0;
|
self->strict = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O", &dialect))
|
if (!PyArg_UnpackTuple(args, "", 0, 1, &dialect))
|
||||||
return -1;
|
return -1;
|
||||||
Py_XINCREF(dialect);
|
Py_XINCREF(dialect);
|
||||||
if (kwargs != NULL) {
|
if (kwargs != NULL) {
|
||||||
|
@ -842,7 +842,7 @@ csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args)
|
||||||
self->field_len = 0;
|
self->field_len = 0;
|
||||||
self->state = START_RECORD;
|
self->state = START_RECORD;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|O", &iterator, &dialect)) {
|
if (!PyArg_UnpackTuple(args, "", 1, 2, &iterator, &dialect)) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1287,7 +1287,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
|
||||||
self->rec_len = 0;
|
self->rec_len = 0;
|
||||||
self->num_fields = 0;
|
self->num_fields = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|O", &output_file, &dialect)) {
|
if (!PyArg_UnpackTuple(args, "", 1, 2, &output_file, &dialect)) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1327,7 +1327,7 @@ csv_register_dialect(PyObject *module, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *name_obj, *dialect_obj;
|
PyObject *name_obj, *dialect_obj;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "OO", &name_obj, &dialect_obj))
|
if (!PyArg_UnpackTuple(args, "", 2, 2, &name_obj, &dialect_obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!PyString_Check(name_obj)
|
if (!PyString_Check(name_obj)
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue