https://github.com/python/cpython/commit/303f92a9ce0de3667fb6b3ed22fa3bea5f835066
commit: 303f92a9ce0de3667fb6b3ed22fa3bea5f835066
branch: main
author: sobolevn <[email protected]>
committer: hauntsaninja <[email protected]>
date: 2024-08-29T06:53:57Z
summary:
gh-123446: Fix empty function names in `TypeError`s in `_csv` module (#123461)
files:
A Misc/NEWS.d/next/Library/2024-08-29-09-27-12.gh-issue-123446._I_mMr.rst
M Modules/_csv.c
diff --git
a/Misc/NEWS.d/next/Library/2024-08-29-09-27-12.gh-issue-123446._I_mMr.rst
b/Misc/NEWS.d/next/Library/2024-08-29-09-27-12.gh-issue-123446._I_mMr.rst
new file mode 100644
index 00000000000000..871b2fb2b646e7
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-08-29-09-27-12.gh-issue-123446._I_mMr.rst
@@ -0,0 +1,3 @@
+Fix empty function name in :exc:`TypeError` when :func:`csv.reader`,
+:func:`csv.writer`, or :func:`csv.register_dialect` are used without the
+required args.
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 737b2c7468e13c..3e2ddbd833a651 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -1072,7 +1072,7 @@ csv_reader(PyObject *module, PyObject *args, PyObject
*keyword_args)
return NULL;
}
- if (!PyArg_UnpackTuple(args, "", 1, 2, &iterator, &dialect)) {
+ if (!PyArg_UnpackTuple(args, "_csv.reader", 1, 2, &iterator, &dialect)) {
Py_DECREF(self);
return NULL;
}
@@ -1519,7 +1519,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject
*keyword_args)
self->error_obj = Py_NewRef(module_state->error_obj);
- if (!PyArg_UnpackTuple(args, "", 1, 2, &output_file, &dialect)) {
+ if (!PyArg_UnpackTuple(args, "_csv.writer", 1, 2, &output_file, &dialect))
{
Py_DECREF(self);
return NULL;
}
@@ -1571,7 +1571,7 @@ csv_register_dialect(PyObject *module, PyObject *args,
PyObject *kwargs)
_csvstate *module_state = get_csv_state(module);
PyObject *dialect;
- if (!PyArg_UnpackTuple(args, "", 1, 2, &name_obj, &dialect_obj))
+ if (!PyArg_UnpackTuple(args, "_csv.register_dialect", 1, 2, &name_obj,
&dialect_obj))
return NULL;
if (!PyUnicode_Check(name_obj)) {
PyErr_SetString(PyExc_TypeError,
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]