New submission from Serhiy Storchaka:

Many re methods accepted the string parameter as a keyword argument by wrong 
name. This was fixed in issue20283. Wrong keyword names were still accepted, 
but a deprecation warning was emitted if use them. Proposed patch finishes the 
deprecation period (started since 3.4) and removes the support of wrong names.

Python 2.7.7, 3.3.6, 3.4-3.6:

>>> import re
>>> re.compile('.').match(pattern='a')
__main__:1: DeprecationWarning: The 'pattern' keyword parameter name is 
deprecated.  Use 'string' instead.
<_sre.SRE_Match object; span=(0, 1), match='a'>
>>> re.compile('.').match(string='a')
<_sre.SRE_Match object; span=(0, 1), match='a'>

Python 3.7:

>>> re.compile('.').match(pattern='a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Required argument 'string' (pos 1) not found

----------
components: Extension Modules
files: re_wrong_string_argument_name.patch
keywords: patch
messages: 284911
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Get rid of supporting outdated wrong keyword arguments in re methods
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46192/re_wrong_string_argument_name.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29195>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to