GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `set` `intersection_update`, `difference_update`, `symmetric_difference_update` should check self is equal to given arg · Issue #3881 · RustPython/RustPython

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

New issue
Copy link
New issue
Copy link
Closed
Closed
set intersection_update, difference_update, symmetric_difference_update should check self is equal to given arg#3881
Copy link
Labels
A-designAbout RustPython's own implementationAbout RustPython's own implementationC-compatA discrepancy between RustPython and CPythonA discrepancy between RustPython and CPythongood first issueGood for newcomersGood for newcomers

Description

@Snowapril
Snowapril
opened on Jul 14, 2022
Issue body actions

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

  • https://github.com/python/cpython/blob/3.10/Objects/setobject.c#L1627-L1630
  • https://github.com/python/cpython/blob/3.10/Objects/setobject.c#L1410-L1412
  • https://github.com/python/cpython/blob/3.10/Objects/setobject.c#L1186-L1189

Relevant Test Case

  • test_set.py test_inplace_on_self

Activity

  1. fanninpm
    added
    good first issueGood for newcomersGood for newcomers
    C-compatA discrepancy between RustPython and CPythonA discrepancy between RustPython and CPython
    A-designAbout RustPython's own implementationAbout RustPython's own implementation
    on Jul 14, 2022
  2. kth496 commented on Jul 15, 2022

    @kth496
    kth496
    on Jul 15, 2022
    Contributor
    More actions

    @youknowone Could you assign me to this issue? 😀

  3. youknowone
    assigned
    kth496
    on Jul 15, 2022
  4. DimitrisJim commented on Nov 7, 2022

    @DimitrisJim
    DimitrisJim
    on Nov 7, 2022
    Member
    More actions

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

  5. youknowone
    unassigned
    kth496
    on Feb 23, 2023
  6. youknowone
    closed this as completedon Jan 9, 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

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.