Skip to content

Commit

Permalink
improved error message
Browse files Browse the repository at this point in the history
  • Loading branch information
dg-pb committed Jan 5, 2025
1 parent da4214a commit 26dded8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Lib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _partial_new(cls, func, /, *args, **keywords):
if args and args[-1] is Placeholder:
raise TypeError("trailing Placeholders are not allowed")
if keywords and Placeholder in keywords.values():
raise TypeError("keyword Placeholders are not allowed")
raise TypeError("Placeholder cannot be passed as a keyword argument")
if isinstance(func, base_cls):
pto_phcount = func._phcount
tot_args = func.args
Expand Down
2 changes: 1 addition & 1 deletion Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
if (val == phold) {
Py_DECREF(pto);
PyErr_SetString(PyExc_TypeError,
"keyword Placeholders are not allowed");
"Placeholder cannot be passed as a keyword argument");
return NULL;
}
if (PyDict_SetItem(pto->kw, key, val) < 0) {
Expand Down

0 comments on commit 26dded8

Please sign in to comment.