Skip to content

set intersection_update, difference_update, symmetric_difference_update should check self is equal to given arg #3881

Closed

Description

@Snowapril

Feature

They are also relevant to inplace operations( iand, isub, ixor ).
CPython checks whether given argument and selfobject are equal and then returns.

  • intersection_update : If self == arg, returns self.copy()
  • difference_update : If self == arg, returns self.clear(); Ok(())
  • symmetric_difference_update : If self == arg, returns self.clear(); Ok(())

At the current implementation, they get a parameter as SetIterable which is converted from PyObjectRef before entering each method.
For checking self == arg, we should convert it after checking.

Python Documentation

Relevant Test Case

  • test_set.py test_inplace_on_self

Activity

  1. added
    C-compatA discrepancy between RustPython and CPython
    A-designAbout RustPython's own implementation
    on Jul 14, 2022
  2. kth496 commented on Jul 15, 2022

    @kth496
    Contributor

    @youknowone Could you assign me to this issue? 😀

  3. DimitrisJim commented on Nov 7, 2022

    @DimitrisJim
    Member

    Bump, hey @kth496, any chance you have time to finish this up?

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

    A-designAbout RustPython's own implementationC-compatA discrepancy between RustPython and CPythongood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions