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 rhettinger
Recipients bup, cheryl.sabella, eric.snow, python-dev, rhettinger, serhiy.storchaka
Date 2018-11-04.21:31:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Maybe it's considered undefined behavior for a subclass to use 
> a method of one of its bases which it has overriden.

In general, it's true that if OrderedDict is a subclass of dict, then it would have no defense against someone making a direct call to the dict base class.  Such a call should be expected to violate the OrderedDicts invariants.

> it's a complete coin toss on whether one of the many internal
> API function will set an attribute or name via PyDict_SetItem 
> or PyObject_SetItem. 

Not really.  The CPython source is supposed to only call PyDict_SetItem when the target is known to be an exact dictionary.  If you find a case where that isn't true, please file a bug report and we'll fix it.

> It might be more appropriate to start a new issue for this, but I'll > leave that decision to somehow who would know for sure.

No need.  We've known about this sort of problem for years.  See for example.  There isn't really much we could do about it without causing other issues that would be worse.

FWIW, this doesn't seem to be a problem in practice.  Further, OrderedDict is expected to become less relevant now that regular dicts are order preserving.
Date User Action Args
2018-11-04 21:31:17rhettingersetrecipients: + rhettinger, python-dev, eric.snow, serhiy.storchaka, bup, cheryl.sabella
2018-11-04 21:31:17rhettingersetmessageid: <>
2018-11-04 21:31:17rhettingerlinkissue25410 messages
2018-11-04 21:31:17rhettingercreate