Skip to content

id(a) != id(a * 1) for tuple, str and bytes  #2840

Closed

Description

@sobolevn

Feature

CPython:

>>> a = (1, 2)
>>> id(a), id(a * 1)
(4379030656, 4379030656)

RustPython:

>>>>> a = (1, 2)
>>>>> id(a), id(a * 1)
(140352989490368, 140352989503168)

This is also covered by seq_tests.test_repeat which is now marked as unittest.expectedFailure.

Activity

  1. sobolevn commented on Aug 10, 2021

    @sobolevn
    ContributorAuthor

    The fix is on its way 🚂

  2. DimitrisJim commented on Aug 10, 2021

    @DimitrisJim
    Member

    Note: similar issue is present for the other immutables that can be multiplied, (str and bytes). Pick those up too if you're up for it.

  3. changed the title [-]`id(a) != id(a * 1)` for `tuple` type[/-] [+]`id(a) != id(a * 1)` for `tuple`, str and bytes [/+] on Aug 11, 2021
  4. sobolevn commented on Aug 11, 2021

    @sobolevn
    ContributorAuthor

    Yeap, will add str and bytes support in a moment 💯

  5. sobolevn commented on Aug 11, 2021

    @sobolevn
    ContributorAuthor

    Related bug report about missing str and bytes tests: https://bugs.python.org/issue44891

  6. DimitrisJim commented on Aug 12, 2021

    @DimitrisJim
    Member

    I'd also submit a PR @sobolevn. The devguide states this at some point. You might want to check that it indeed isn't covered by running gcov but that sounds like overkill in this case.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions