forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Milestone
Description
CircuitPython version
MicroPython 9.0.0-alpha.6-49-gb704452f70 on 2024-01-27; linux [GCC 11.4.0] versionCode/REPL
class MyDict(dict):
def __init__(self, initial_dict=None):
super().__init__(initial_dict)
d = dict({'foo': 'bar', 'a': 123})
print(d.keys()) # keys is correct
d = MyDict({'foo': 'bar', 'a': 123})
print(d.keys()) # keys is emptyBehavior
When running the above example, the base dictionary is not initialized correctly.
Output using CircuitPython:
{'a': 123, 'foo': 'bar'} dict_keys(['a', 'foo'])
{'a': 123, 'foo': 'bar'} dict_keys([])
Output using MicroPython:
{'a': 123, 'foo': 'bar'} dict_keys(['a', 'foo'])
{'a': 123, 'foo': 'bar'} dict_keys(['a', 'foo'])
Output using CPython:
{'foo': 'bar', 'a': 123} dict_keys(['foo', 'a'])
{'foo': 'bar', 'a': 123} dict_keys(['foo', 'a'])
Description
I think this might be in part related to #8758, but unfortunately that fix does not help.
Additional information
No response