Issue #6081: Add str.format_map. str.format_map(mapping) is similar to str.format(**mapping), except mapping does not get converted to a dict.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 17dc27e..b67b8f9 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9028,6 +9028,11 @@
\n\
");
+PyDoc_STRVAR(format_map__doc__,
+ "S.format_map(mapping) -> str\n\
+\n\
+");
+
static PyObject *
unicode__format__(PyObject* self, PyObject* args)
{
@@ -9109,6 +9114,7 @@
{"isprintable", (PyCFunction) unicode_isprintable, METH_NOARGS, isprintable__doc__},
{"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__},
{"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
+ {"format_map", (PyCFunction) do_string_format_map, METH_O, format_map__doc__},
{"__format__", (PyCFunction) unicode__format__, METH_VARARGS, p_format__doc__},
{"maketrans", (PyCFunction) unicode_maketrans,
METH_VARARGS | METH_STATIC, maketrans__doc__},