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

weakref documentation contains cautions about dictionary mutation problems that have been solved in the implementation #85072

Closed
asqui mannequin opened this issue Jun 6, 2020 · 5 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@asqui
Copy link
Mannequin

asqui mannequin commented Jun 6, 2020

BPO 40895
Nosy @pitrou, @asqui, @miss-islington
PRs
  • bpo-40895: Update weakref documentation to remove old warnings #20687
  • [3.9] bpo-40895: Update weakref documentation to remove old warnings (GH-20687) #20791
  • [3.8] bpo-40895: Update weakref documentation to remove old warnings (GH-20687) #20792
  • [3.7] bpo-40895: Update weakref documentation to remove old warnings (GH-20687) #20793
  • 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 2020-06-10.20:39:29.369>
    created_at = <Date 2020-06-06.23:23:07.853>
    labels = ['type-bug', '3.8', '3.9', '3.10', '3.7', 'docs']
    title = 'weakref documentation contains cautions about dictionary mutation problems that have been solved in the implementation'
    updated_at = <Date 2020-06-10.20:39:29.365>
    user = 'https://github.com/asqui'

    bugs.python.org fields:

    activity = <Date 2020-06-10.20:39:29.365>
    actor = 'pitrou'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2020-06-10.20:39:29.369>
    closer = 'pitrou'
    components = ['Documentation']
    creation = <Date 2020-06-06.23:23:07.853>
    creator = 'dfortunov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40895
    keywords = ['patch']
    message_count = 5.0
    messages = ['370860', '371241', '371242', '371245', '371246']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'docs@python', 'dfortunov', 'miss-islington']
    pr_nums = ['20687', '20791', '20792', '20793']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40895'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    @asqui
    Copy link
    Mannequin Author

    asqui mannequin commented Jun 6, 2020

    The doccumentation at https://docs.python.org/3.10/library/weakref.html cautions that the WeakKeyDictionary and WeakValueDictionary are susceptible to the problem of dictionary mutation during iteration.

    These notes present the user with a problem that has no easy solution.

    I dug into the implementation and found that fortunately, Antoine Pitrou already addressed this challenge (10 years ago!) by introducing an _IterationGuard context manager to the implementation, which delays mutation while an iteration is in progress.

    I asked for confirmation and Antoine agreed that these notes could be removed:
    c1baa60#commitcomment-39514438

    @asqui asqui mannequin added the 3.10 only security fixes label Jun 6, 2020
    @asqui asqui mannequin assigned docspython Jun 6, 2020
    @asqui asqui mannequin added docs Documentation in the Doc dir labels Jun 6, 2020
    @miss-islington
    Copy link
    Contributor

    New changeset 1642c0e by Daniel Fortunov in branch 'master':
    bpo-40895: Update weakref documentation to remove old warnings (GH-20687)
    1642c0e

    @miss-islington
    Copy link
    Contributor

    New changeset 18e07ba by Miss Islington (bot) in branch '3.9':
    bpo-40895: Update weakref documentation to remove old warnings (GH-20687)
    18e07ba

    @miss-islington
    Copy link
    Contributor

    New changeset 0490398 by Antoine Pitrou in branch '3.7':
    [3.7] bpo-40895: Update weakref documentation to remove old warnings (GH-20687) (GH-20793)
    0490398

    @miss-islington
    Copy link
    Contributor

    New changeset 972aba8 by Antoine Pitrou in branch '3.8':
    [3.8] bpo-40895: Update weakref documentation to remove old warnings (GH-20687) (GH-20792)
    972aba8

    @pitrou pitrou added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Jun 10, 2020
    @pitrou pitrou closed this as completed Jun 10, 2020
    @pitrou pitrou added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error 3.8 only security fixes 3.9 only security fixes labels Jun 10, 2020
    @pitrou pitrou closed this as completed Jun 10, 2020
    @pitrou pitrou added the type-bug An unexpected behavior, bug, or error label Jun 10, 2020
    @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 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants