python / cpython

The Python programming language
https://www.python.org
Other
62.75k stars 30.07k forks source link

PyCData_Type.tp_hash doesn't use PyObject_HashNotImplemented #78327

Open df79943f-4aee-4531-a00d-c6b12816eb70 opened 6 years ago

df79943f-4aee-4531-a00d-c6b12816eb70 commented 6 years ago
BPO 34146
Nosy @mr-nfamous

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: ```python assignee = None closed_at = None created_at = labels = ['ctypes', '3.8'] title = "PyCData_Type.tp_hash doesn't use PyObject_HashNotImplemented" updated_at = user = 'https://github.com/mr-nfamous' ``` bugs.python.org fields: ```python activity = actor = 'bup' assignee = 'none' closed = False closed_date = None closer = None components = ['ctypes'] creation = creator = 'bup' dependencies = [] files = [] hgrepos = [] issue_num = 34146 keywords = [] message_count = 1.0 messages = ['321878'] nosy_count = 1.0 nosy_names = ['bup'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = None url = 'https://bugs.python.org/issue34146' versions = ['Python 3.8'] ```

df79943f-4aee-4531-a00d-c6b12816eb70 commented 6 years ago

So not only does the function it does use (PyCData_nohash) prevent PyType_Ready from setting _ctypes._SimpleCData.dict["hash"] to None, (contrary to to every other unhashable type in the standard library) but the error message it returns is less detailed.

It seems like a big deal if this were to be changed as it could break backwards compatibility so I won't open PR myself as I'm still not that familiar with the contribution process.