Skip to content

Commit 26dded8

Browse files
committed
improved error message
1 parent da4214a commit 26dded8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: Lib/functools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def _partial_new(cls, func, /, *args, **keywords):
327327
if args and args[-1] is Placeholder:
328328
raise TypeError("trailing Placeholders are not allowed")
329329
if keywords and Placeholder in keywords.values():
330-
raise TypeError("keyword Placeholders are not allowed")
330+
raise TypeError("Placeholder cannot be passed as a keyword argument")
331331
if isinstance(func, base_cls):
332332
pto_phcount = func._phcount
333333
tot_args = func.args

Diff for: Modules/_functoolsmodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
297297
if (val == phold) {
298298
Py_DECREF(pto);
299299
PyErr_SetString(PyExc_TypeError,
300-
"keyword Placeholders are not allowed");
300+
"Placeholder cannot be passed as a keyword argument");
301301
return NULL;
302302
}
303303
if (PyDict_SetItem(pto->kw, key, val) < 0) {

0 commit comments

Comments
 (0)