summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c5
-rw-r--r--Objects/unicodeobject.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 8bc97f7..091ede7 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -2939,8 +2939,9 @@ PyString_Format(PyObject *format, PyObject *args)
break;
default:
PyErr_Format(PyExc_ValueError,
- "unsupported format character '%c' (0x%x)",
- c, c);
+ "unsupported format character '%c' (0x%x) "
+ "at index %i",
+ c, c, fmt - 1 - PyString_AsString(format));
goto error;
}
if (sign) {
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a297cac..5ee72bd 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5067,8 +5067,9 @@ PyObject *PyUnicode_Format(PyObject *format,
default:
PyErr_Format(PyExc_ValueError,
- "unsupported format character '%c' (0x%x)",
- c, c);
+ "unsupported format character '%c' (0x%x) "
+ "at index %i",
+ c, c, fmt -1 - PyUnicode_AS_UNICODE(uformat));
goto onError;
}
if (sign) {