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

Remove support of special method __div__ in unittest.mock #89173

Closed
serhiy-storchaka opened this issue Aug 26, 2021 · 4 comments
Closed

Remove support of special method __div__ in unittest.mock #89173

serhiy-storchaka opened this issue Aug 26, 2021 · 4 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir

Comments

@serhiy-storchaka
Copy link
Member

BPO 45010
Nosy @voidspace, @ambv, @serhiy-storchaka
PRs
  • bpo-45010: Remove support of special method __div__ in unittest.mock #27965
  • 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 2021-08-26.18:30:32.407>
    created_at = <Date 2021-08-26.06:49:49.033>
    labels = ['library', '3.11']
    title = 'Remove support of special method __div__ in unittest.mock'
    updated_at = <Date 2021-08-26.18:30:32.406>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2021-08-26.18:30:32.406>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-08-26.18:30:32.407>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2021-08-26.06:49:49.033>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45010
    keywords = ['patch']
    message_count = 4.0
    messages = ['400314', '400315', '400362', '400364']
    nosy_count = 3.0
    nosy_names = ['michael.foord', 'lukasz.langa', 'serhiy.storchaka']
    pr_nums = ['27965']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue45010'
    versions = ['Python 3.11']

    @serhiy-storchaka
    Copy link
    Member Author

    Special method __div__ was used in Python 2, but is not used in Python 3. I think it can be removed from the list of supported special methods in unittest.mock.

    @serhiy-storchaka serhiy-storchaka added 3.11 only security fixes stdlib Python modules in the Lib dir labels Aug 26, 2021
    @serhiy-storchaka
    Copy link
    Member Author

    It was kept in the previous clean up in bpo-23641 because I had doubts. But now I do not see reasons to keep it. Rather keeping it can confuse users.

    @ambv
    Copy link
    Contributor

    ambv commented Aug 26, 2021

    New changeset f9cd40f by Serhiy Storchaka in branch 'main':
    bpo-45010: Remove support of special method __div__ in unittest.mock (GH-27965)
    f9cd40f

    @ambv
    Copy link
    Contributor

    ambv commented Aug 26, 2021

    Agreed, let's get rid of it. Thanks!

    I grepped for this and there's still one left-over here:

    def __div__(self) -> 'SimplePath':
    ... # pragma: no cover

    Fortunately, this was already fixed upstream:

    python/importlib_metadata#334

    Next time Jason syncs importlib.metadata with upstream this will be solved as well. Currently we're synced with 4.6.0 while the fix went in in 4.6.4.

    Also fortunately, this is low-pri since this is only in type annotations.

    @ambv ambv closed this as completed Aug 26, 2021
    @ambv ambv closed this as completed Aug 26, 2021
    @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.11 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants