Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of supporting outdated wrong keyword arguments in re methods #73381

Closed
serhiy-storchaka opened this issue Jan 7, 2017 · 4 comments
Closed
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 29195
Nosy @rhettinger, @serhiy-storchaka
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • re_wrong_string_argument_name.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-01-13.07:02:34.610>
    created_at = <Date 2017-01-07.12:04:53.884>
    labels = ['extension-modules', 'type-feature', '3.7']
    title = 'Get rid of supporting outdated wrong keyword arguments in re methods'
    updated_at = <Date 2017-03-31.16:36:15.001>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:15.001>
    actor = 'dstufft'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-01-13.07:02:34.610>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2017-01-07.12:04:53.884>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['46192']
    hgrepos = []
    issue_num = 29195
    keywords = ['patch']
    message_count = 4.0
    messages = ['284911', '284963', '285009', '285362']
    nosy_count = 3.0
    nosy_names = ['rhettinger', 'python-dev', 'serhiy.storchaka']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue29195'
    versions = ['Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    Many re methods accepted the string parameter as a keyword argument by wrong name. This was fixed in bpo-20283. 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

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Jan 7, 2017
    @rhettinger
    Copy link
    Contributor

    It's too bad that "pattern" lost out to the less informative "string".

    +1 for finishing the work and applying this patch.

    @serhiy-storchaka
    Copy link
    Member Author

    "pattern" is not more informative, it is just wrong. The argument of the match() method is not a pattern, it is a string with which a pattern is matched.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 13, 2017

    New changeset f8678135c042 by Serhiy Storchaka in branch 'default':
    Issue bpo-29195: Removed support of deprecated undocumented keyword arguments
    https://hg.python.org/cpython/rev/f8678135c042

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants