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

Got rid of bad dunder names #67829

Closed
serhiy-storchaka opened this issue Mar 11, 2015 · 9 comments
Closed

Got rid of bad dunder names #67829

serhiy-storchaka opened this issue Mar 11, 2015 · 9 comments
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 23641
Nosy @pitrou, @ezio-melotti, @voidspace, @berkerpeksag, @vadmium, @serhiy-storchaka
Dependencies
  • bpo-23581: unittest.mock.MagicMock doesn't support matmul (@) operator
  • Files
  • bad_dunder_names.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 2016-06-19.15:34:19.437>
    created_at = <Date 2015-03-11.14:42:14.678>
    labels = ['tests', 'type-bug', 'library']
    title = 'Got rid of bad dunder names'
    updated_at = <Date 2016-06-19.15:34:19.436>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2016-06-19.15:34:19.436>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-06-19.15:34:19.437>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2015-03-11.14:42:14.678>
    creator = 'serhiy.storchaka'
    dependencies = ['23581']
    files = ['38443']
    hgrepos = []
    issue_num = 23641
    keywords = ['patch']
    message_count = 9.0
    messages = ['237868', '237869', '237908', '237976', '237978', '237980', '237981', '268852', '268853']
    nosy_count = 7.0
    nosy_names = ['pitrou', 'ezio.melotti', 'michael.foord', 'python-dev', 'berker.peksag', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23641'
    versions = ['Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    Proposed patch gets rid of uses and mentions of bad dunder names. I.e. names inherited from Python 2: __cmp__, __nonzero__, __getslice__, __unicode__, __div__, etc. They are replaced by correct names (truediv, __floordiv__, __eq__, __bool__, etc) or removed. Also fixed typos and other minor bugs. Also added support for __matmul__ and __getnewargs_ex__ in unittest.mock and added tests for __matmul__.

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Mar 11, 2015
    @berkerpeksag
    Copy link
    Member

    Also added support for __matmul__ and __getnewargs_ex__ in unittest.mock [...]

    See bpo-23581 for __matmul__ support.

    @vadmium
    Copy link
    Member

    vadmium commented Mar 11, 2015

    I’m not very familiar with the mock module so can't comment if removing div is sensible there. But all the other changes seem reasonable. I just left a few suggestions for further tweaks on Rietveld.

    @serhiy-storchaka
    Copy link
    Member Author

    Do you want first commit the patch in bpo-23581 Berker?

    @berkerpeksag
    Copy link
    Member

    Do you want first commit the patch in bpo-23581 Berker?

    I just committed it. Thanks for the review :)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 12, 2015

    New changeset 7522bb14e36a by Serhiy Storchaka in branch '3.4':
    Issue bpo-23641: Cleaned out legacy dunder names from tests and docs.
    https://hg.python.org/cpython/rev/7522bb14e36a

    New changeset 9332a545ad85 by Serhiy Storchaka in branch 'default':
    Issue bpo-23641: Cleaned out legacy dunder names from tests and docs.
    https://hg.python.org/cpython/rev/9332a545ad85

    @serhiy-storchaka
    Copy link
    Member Author

    Committed all except changes to multiprocessing.sharedctypes (remove __getslice__ and __setslice__) and unittest.mock (remove __div__, add __getnewargs_ex__).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 19, 2016

    New changeset 75cec736f87d by Serhiy Storchaka in branch '3.5':
    Issue bpo-23641: Added __getnewargs_ex__ to the list of special mock attributes.
    https://hg.python.org/cpython/rev/75cec736f87d

    New changeset 4c5f7b61b6c5 by Serhiy Storchaka in branch 'default':
    Issue bpo-23641: Added __getnewargs_ex__ to the list of special mock attributes.
    https://hg.python.org/cpython/rev/4c5f7b61b6c5

    @serhiy-storchaka
    Copy link
    Member Author

    I'm not sure about removing __getslice__ and __setslice__ from multiprocessing.sharedctypes and __div__ from unittest.mock, and left them as is.

    @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
    stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants