This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author blakeross
Recipients
Date 2007-06-04.03:59:53
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
>>> class MyDict(dict):
...     def keys(self): print "keys"
...     def __getitem__(self, n): print "__getitem__"
...
>>> myDict = MyDict(a=1, b=2)
>>> dict(myDict)
{'a': 1, 'b': 2}

PyDict_Merge accesses the items of the dict to be merged directly rather than going through the interface for any dict instance--even a dict derivative--by virtue of using PyDict_Check rather than PyDict_CheckExact. I believe the logic needs to be:

if type(d).__getitem__ is dict.__getitem__ and type(d).keys is dict.keys:
    ...okay to access items directly...
else:
    ...go through the methods...
History
Date User Action Args
2007-08-23 14:54:34adminlinkissue1730480 messages
2007-08-23 14:54:34admincreate