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.

classification
Title: __missing__ not completely implemented in dictobject.c
Type: behavior Stage:
Components: None Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, bvukov
Priority: normal Keywords:

Created on 2009-07-12 16:50 by bvukov, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg90450 - (view) Author: Bosko Vukov (bvukov) Date: 2009-07-12 16:50
For some reason functions PyDict_GetItem ( and PyDict_GetItemString )
don't try to check for '__missing__' on subclass, but
dict_subscript(dictobject *mp, register PyObject *key) does.
Only in this function a failure to get a value using
ma_lookup checks afterwards using !PyDict_CheckExact for subclass
definition of '__missing__', and then returns a value.
Is this intended or just a half implementation ?
msg90451 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-07-12 17:03
Yes, this is intended. PyDict_GetItem already bypasses user __getitem__
methods, so it's logical it would do the same for __missing__.
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50717
2009-07-12 17:03:00benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg90451

resolution: wont fix
2009-07-12 16:50:48bvukovcreate