From 08e65430aafa1047029e6f132a5f748c415bda14 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 25 May 2024 16:21:11 +0300 Subject: [PATCH] gh-111999: Fix the signature of str.format_map() (#119540) --- Doc/library/stdtypes.rst | 2 +- .../2024-05-25-13-51-48.gh-issue-111999.L0q1gh.rst | 1 + Objects/unicodeobject.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2024-05-25-13-51-48.gh-issue-111999.L0q1gh.rst diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index c0a3d0b3a2a..c8acde8b57d 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1768,7 +1768,7 @@ expression support in the :mod:`re` module). cases. -.. method:: str.format_map(mapping) +.. method:: str.format_map(mapping, /) Similar to ``str.format(**mapping)``, except that ``mapping`` is used directly and not copied to a :class:`dict`. This is useful diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-05-25-13-51-48.gh-issue-111999.L0q1gh.rst b/Misc/NEWS.d/next/Core and Builtins/2024-05-25-13-51-48.gh-issue-111999.L0q1gh.rst new file mode 100644 index 00000000000..4b1ca6ca5b0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2024-05-25-13-51-48.gh-issue-111999.L0q1gh.rst @@ -0,0 +1 @@ +Fix the signature of :meth:`str.format_map`. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index afff37467ca..048f9a814c3 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13490,7 +13490,7 @@ Return a formatted version of the string, using substitutions from args and kwar The substitutions are identified by braces ('{' and '}')."); PyDoc_STRVAR(format_map__doc__, - "format_map($self, /, mapping)\n\ + "format_map($self, mapping, /)\n\ --\n\ \n\ Return a formatted version of the string, using substitutions from mapping.\n\