summaryrefslogtreecommitdiffstats
path: root/Objects/dict-common.h
Commit message (Collapse)AuthorAgeFilesLines
* bpo-33312: Fix clang ubsan out of bounds warnings in dict. (GH-6537)Gregory P. Smith2018-04-201-9/+2
| | | | | | | | | | | | | | | | | | | | Fix clang ubsan (undefined behavior sanitizer) warnings in dictobject.c by adjusting how the internal struct _dictkeysobject shared keys structure is declared. This remains ABI compatible. We get rid of the union at the end of the struct being used for conveinence to avoid typecasting in favor of char[] variable length array at the end of a struct. This is known to clang to be used for variable sized objects and will not cause an undefined behavior problem. Similarly, char arrays do not have strict aliasing undefined behavior when cast. PEP-007 does not currently list variable length arrays (VLAs) as allowed in our subset of C99. If this turns out to be a problem, the fix to this is to change the char `dk_indices[]` into `dk_indices[1]` and restore the three size computation subtractions this change removes: `- Py_MEMBER_SIZE(PyDictKeysObject, dk_indices)` If this works as is I'll make a separate PR to update PEP-007.
* bpo-29304: Simplify dict lookup functions (GH-2407)INADA Naoki2017-08-031-2/+1
| | | | * remove hashpos parameter from lookdict functions. * remove many duplicated code from lookdict functions.
* Issue #28818: Simplify lookdict functionsINADA Naoki2016-12-071-1/+1
|
* Add _PyDict_CheckConsistency()Victor Stinner2016-09-141-4/+2
| | | | | | | | Issue #28127: Add a function to check that a dictionary remains consistent after any change. By default, tables are not checked, only basic attributes. Define DEBUG_PYDICT (ex: gcc -D DEBUG_PYDICT) to also check dictionary "content".
* do not worry about 64-bit dict sizes on 32-bit platformsBenjamin Peterson2016-09-081-1/+3
|
* access dk_indices through a unionBenjamin Peterson2016-09-081-1/+6
|
* Add documentation to the dict implementationVictor Stinner2016-09-081-2/+41
| | | | Issue #27350.
* Implement compact dictVictor Stinner2016-09-081-3/+13
| | | | | | | | | | | | Issue #27350: `dict` implementation is changed like PyPy. It is more compact and preserves insertion order. _PyDict_Dummy() function has been removed. Disable test_gdb: python-gdb.py is not updated yet to the new structure of compact dictionaries (issue #28023). Patch written by INADA Naoki.
* Issue #16991: Add a C implementation of collections.OrderedDict.Eric Snow2015-05-301-0/+22