Skip to content

set union method ignores arguments appearing after the original set #50822

Closed

Description

@ssmout
mannequin
BPO 6573
Nosy @rhettinger
Files
  • set_union.patch: fix
  • 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 = 'https://github.com/rhettinger'
    closed_at = <Date 2009-07-27.20:33:44.642>
    created_at = <Date 2009-07-25.15:24:20.292>
    labels = []
    title = 'set union method ignores arguments appearing after the original set'
    updated_at = <Date 2009-07-27.20:33:44.628>
    user = 'https://bugs.python.org/ssmout'

    bugs.python.org fields:

    activity = <Date 2009-07-27.20:33:44.628>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2009-07-27.20:33:44.642>
    closer = 'rhettinger'
    components = []
    creation = <Date 2009-07-25.15:24:20.292>
    creator = 'ssmout'
    dependencies = []
    files = ['14565']
    hgrepos = []
    issue_num = 6573
    keywords = ['patch']
    message_count = 3.0
    messages = ['90925', '90987', '90997']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'ssmout']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue6573'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    Activity

    1. ssmout commented on Jul 25, 2009

      ssmoutmannequin
      MannequinAuthor

      When calling the union method of a set with several arguments, if one of
      those sets is the original set, all arguments appearing after it are
      ignored. For example:

      x = set()
      x.union(set([1]), x, set([2]))

      evaluates to set([1]), not set([1, 2]) as expected. As another example,
      since all empty frozensets are the same,

      frozenset().union(frozenset([1]), frozenset(), frozenset([2]))

      also evaluates to just frozenset([1]).

      The fix is trivial, so I'm attaching a patch.

    2. rhettinger commented on Jul 27, 2009

      @rhettinger
      Contributor

      Good catch. Thanks.

    3. rhettinger commented on Jul 27, 2009

      @rhettinger
      Contributor

      Fixed. See r74226, r74227, r74228 and r74229.

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions