Skip to content

Register array.array to collections.abc.MutableSequence #4469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 25, 2023

Conversation

moreal
Copy link
Contributor

@moreal moreal commented Jan 23, 2023

This pull request registers array.array to collections.abc.MutableSequence._abc_registry and it makes isinstance(array.array("<type>"), collections.abc.MutableSequence) as true.

There is an issue that it cannot load MutableSequence from collections.abc, so I bypassed it by loading MutableSequence from _collections_abc directly. But it should be fixed or note comments about specific reason.

You can run the below code to test these changes:

import array, collections.abc; print(isinstance(array.array('B'), collections.abc.MutableSequence))

Related links

moreal and others added 2 commits January 24, 2023 15:37
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Copy link
Member

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks moreal!

@DimitrisJim DimitrisJim merged commit 78e815c into RustPython:main Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants