[issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses

Steven D'Aprano report at bugs.python.org
Mon Nov 5 02:14:10 EST 2018


Steven D'Aprano <steve+python at pearwood.info> added the comment:

You say it doesn't work as expected, but you don't say what you expect or why. (Don't make me guess what you mean -- explicit is better than implicit.)

When I try your subclass in 3.6, I get an unexpected TypeError:

py> class Dict(dict):
...     def keys(self): assert 0
...     def update(*args, **kwds): assert 0
...     def __getitem__(self, key): assert 0
...     def __iter__(self): assert 0
...
py> {**Dict(a=1)}
{'a': 1}
py> Dict(a=1).keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in keys
TypeError

----------
nosy: +steven.daprano

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35166>
_______________________________________


More information about the Python-bugs-list mailing list