Skip to content

Commit 303f92a

Browse files
authored
gh-123446: Fix empty function names in TypeErrors in _csv module (#123461)
1 parent 0c3ea30 commit 303f92a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix empty function name in :exc:`TypeError` when :func:`csv.reader`,
2+
:func:`csv.writer`, or :func:`csv.register_dialect` are used without the
3+
required args.

Modules/_csv.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args)
10721072
return NULL;
10731073
}
10741074

1075-
if (!PyArg_UnpackTuple(args, "", 1, 2, &iterator, &dialect)) {
1075+
if (!PyArg_UnpackTuple(args, "_csv.reader", 1, 2, &iterator, &dialect)) {
10761076
Py_DECREF(self);
10771077
return NULL;
10781078
}
@@ -1519,7 +1519,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
15191519

15201520
self->error_obj = Py_NewRef(module_state->error_obj);
15211521

1522-
if (!PyArg_UnpackTuple(args, "", 1, 2, &output_file, &dialect)) {
1522+
if (!PyArg_UnpackTuple(args, "_csv.writer", 1, 2, &output_file, &dialect)) {
15231523
Py_DECREF(self);
15241524
return NULL;
15251525
}
@@ -1571,7 +1571,7 @@ csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs)
15711571
_csvstate *module_state = get_csv_state(module);
15721572
PyObject *dialect;
15731573

1574-
if (!PyArg_UnpackTuple(args, "", 1, 2, &name_obj, &dialect_obj))
1574+
if (!PyArg_UnpackTuple(args, "_csv.register_dialect", 1, 2, &name_obj, &dialect_obj))
15751575
return NULL;
15761576
if (!PyUnicode_Check(name_obj)) {
15771577
PyErr_SetString(PyExc_TypeError,

0 commit comments

Comments
 (0)