Skip to content

set.update should not use IterNext #3866

Closed
@Snowapril

Description

@Snowapril

Feature

Our set.update uses IterNext for iterating given args and update the set contents (makes sense).
But this makes incompatibility with cpython.
cpython's implementation is converting given args to tuple and uses get_size and get_item.
As these method does not go through the iternext, there is no exception if the set is mutated during update.

Python Documentation

https://github.com/python/cpython/blob/3.10/Objects/setobject.c#L930-L941

Related test cases

  • test_set.py test_merge_and_mutate

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions