IronLanguages / IronLanguages/ironpython3
dict subclasses which override __iter__ should be treated as mappings
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
Here are some examples:
class test(dict):
def __iter__(self):
return super().__iter__()
def keys(self):
return ["A"]
def __getitem__(self, key):
return 1
A = {"A": 1}
B = test({"B": 2})
assert dict(B) == A
assert dict(**B) == A
def fn(**kw):
return kw
assert fn(**B) == A
d = {}
d.update(B)
assert d == A
d = {}
d.update(**B)
assert d == A
This is causing an issue with order preserving dicts and collections.OrderedDict.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided dict-subclass examples in IronPython, including dict(), ** unpacking, update(), and the OrderedDict case. Trace how these operations classify dict subclasses that override iter, then add focused regression coverage; done means the assertions pass and mapping order is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100