Skip to content

weakset isdisjoint misses an equal temporary object #162523

Backlog

Description

@tonghuaroot

Bug report

the iterator yields a temporary object equal to a live member of the set. both calls should return false, but the weak set returns true.

from collections import UserString
from weakref import WeakSet

item = UserString('a')
print(WeakSet([item]).isdisjoint(map(UserString, 'a')))  # True
print(set([item]).isdisjoint(map(UserString, 'a')))      # False

CPython versions tested on:

3.16

Operating systems tested on:

macOS

Linked PRs

Activity

  1. added
    type-bug
    on Nov 24, 2026
  2. added
    stdlib
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions