Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__missing__ not completely implemented in dictobject.c #50717

Closed
bvukov mannequin opened this issue Jul 12, 2009 · 2 comments
Closed

__missing__ not completely implemented in dictobject.c #50717

bvukov mannequin opened this issue Jul 12, 2009 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@bvukov
Copy link
Mannequin

bvukov mannequin commented Jul 12, 2009

BPO 6468
Nosy @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-07-12.17:03:00.893>
created_at = <Date 2009-07-12.16:50:48.666>
labels = ['type-bug']
title = '__missing__ not completely implemented in dictobject.c'
updated_at = <Date 2009-07-12.17:03:00.886>
user = 'https://bugs.python.org/bvukov'

bugs.python.org fields:

activity = <Date 2009-07-12.17:03:00.886>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2009-07-12.17:03:00.893>
closer = 'benjamin.peterson'
components = ['None']
creation = <Date 2009-07-12.16:50:48.666>
creator = 'bvukov'
dependencies = []
files = []
hgrepos = []
issue_num = 6468
keywords = []
message_count = 2.0
messages = ['90450', '90451']
nosy_count = 2.0
nosy_names = ['bvukov', 'benjamin.peterson']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue6468'
versions = ['Python 2.5']

@bvukov
Copy link
Mannequin Author

bvukov mannequin commented Jul 12, 2009

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 ?

@bvukov bvukov mannequin added the type-bug An unexpected behavior, bug, or error label Jul 12, 2009
@benjaminp
Copy link
Contributor

Yes, this is intended. PyDict_GetItem already bypasses user __getitem__
methods, so it's logical it would do the same for __missing__.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant