[New-bugs-announce] [issue29193] Remove support of format_string as keyword argument in string.Formatter().format()

Serhiy Storchaka report at bugs.python.org
Sat Jan 7 06:35:11 EST 2017


New submission from Serhiy Storchaka:

Passing a format string as a keyword argument to string.Formatter.format() was deprecated in 3.5 (issue23671). Proposed patch finishes the deprecation period and converts a warning to an error.

Python 3.5-3.6:

>>> string.Formatter().format(format_string='foo: {foo}', foo=123)
__main__:1: DeprecationWarning: Passing 'format_string' as keyword argument is deprecated
'foo: 123'

Python 3.7:

>>> string.Formatter().format(format_string='foo: {foo}', foo=123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/string.py", line 179, in format
    "argument: 'format_string'") from None
TypeError: format() missing 1 required positional argument: 'format_string'

----------
components: Library (Lib)
files: string_formatter_positional_only.patch
keywords: patch
messages: 284907
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Remove support of format_string as keyword argument in string.Formatter().format()
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46189/string_formatter_positional_only.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29193>
_______________________________________


More information about the New-bugs-announce mailing list