Kaydet (Commit) 1721e757 authored tarafından Georg Brandl's avatar Georg Brandl

Fix error message -- "expects either 0 or 0 arguments"

üst 1c88e0f5
...@@ -595,8 +595,10 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw) ...@@ -595,8 +595,10 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
res = 0; /* if no error occurs, this stays 0 to the end */ res = 0; /* if no error occurs, this stays 0 to the end */
if (PyTuple_GET_SIZE(args) > 0) { if (PyTuple_GET_SIZE(args) > 0) {
if (numfields != PyTuple_GET_SIZE(args)) { if (numfields != PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes either 0 or " PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
"%d positional argument%s", Py_TYPE(self)->tp_name, "%" PY_FORMAT_SIZE_T "d positional argument%s",
Py_TYPE(self)->tp_name,
numfields == 0 ? "" : "either 0 or ",
numfields, numfields == 1 ? "" : "s"); numfields, numfields == 1 ? "" : "s");
res = -1; res = -1;
goto cleanup; goto cleanup;
......
...@@ -386,8 +386,10 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw) ...@@ -386,8 +386,10 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
res = 0; /* if no error occurs, this stays 0 to the end */ res = 0; /* if no error occurs, this stays 0 to the end */
if (PyTuple_GET_SIZE(args) > 0) { if (PyTuple_GET_SIZE(args) > 0) {
if (numfields != PyTuple_GET_SIZE(args)) { if (numfields != PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes either 0 or " PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
"%d positional argument%s", Py_TYPE(self)->tp_name, "%" PY_FORMAT_SIZE_T "d positional argument%s",
Py_TYPE(self)->tp_name,
numfields == 0 ? "" : "either 0 or ",
numfields, numfields == 1 ? "" : "s"); numfields, numfields == 1 ? "" : "s");
res = -1; res = -1;
goto cleanup; goto cleanup;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment