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

Deprecate passing some conflicting arguments by keyword #80673

Closed
serhiy-storchaka opened this issue Mar 31, 2019 · 4 comments
Closed

Deprecate passing some conflicting arguments by keyword #80673

serhiy-storchaka opened this issue Mar 31, 2019 · 4 comments
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 36492
Nosy @serhiy-storchaka, @tirkarthi
PRs
  • bpo-36492: Deprecate passing some arguments as keyword arguments. #12637
  • [3.7] bpo-36492: Fix passing special keyword arguments to some functions. (GH-12637) #12645
  • 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 2019-04-01.08:00:55.255>
    created_at = <Date 2019-03-31.07:17:26.952>
    labels = ['3.8', 'type-bug', 'library']
    title = 'Deprecate passing some conflicting arguments by keyword'
    updated_at = <Date 2019-04-01.08:00:55.254>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-04-01.08:00:55.254>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-04-01.08:00:55.255>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2019-03-31.07:17:26.952>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36492
    keywords = ['patch']
    message_count = 4.0
    messages = ['339249', '339280', '339283', '339284']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'xtreak']
    pr_nums = ['12637', '12645']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36492'
    versions = ['Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    As Steve mentioned in the discussion about PEP-570 [1], some changes of parameters to positional-only are breaking (although there is no breaks in the stdlib code). Before making parameters positional-only we should add a deprecation warning for passing them as keyword arguments. Similarly to the code used in the UserDict constructor (see bpo-22609).

    The following PR adds deprecation warnings for other parameters which should be positional-only. It also fixes bugs about nonavailability to pass special keyword names like "self" or "func". Just one example:

    >>> import functools
    >>> def f(self, func): pass
    ... 
    >>> functools.partialmethod(f, func=chr)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: __init__() got multiple values for argument 'func'

    [1] https://discuss.python.org/t/pep-570-python-positional-only-parameters/1078/53

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 31, 2019
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 42a139e by Serhiy Storchaka in branch 'master':
    bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)
    42a139e

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset a37f356 by Serhiy Storchaka in branch '3.7':
    [3.7] bpo-36492: Fix passing special keyword arguments to some functions. (GH-12637) (GH-12645)
    a37f356

    @serhiy-storchaka
    Copy link
    Member Author

    Fixes (but not deprecations) were backported to 3.7.

    @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.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant