Commit graph

424 commits

Author SHA1 Message Date
Raymond Hettinger
b12785d456 Reference the original compact-and-ordered proposal 2016-10-22 09:58:14 -07:00
doko@ubuntu.com
de69ee71e2 - dictobject.c: Make dict_merge symbol a static symbol 2016-10-11 08:04:02 +02:00
doko@ubuntu.com
c96df68ea3 - dictobject.c: Make dict_merge symbol a static symbol 2016-10-11 08:04:02 +02:00
Serhiy Storchaka
49f5cdde1a Issue #28183: Optimize and cleanup dict iteration. 2016-10-09 23:08:05 +03:00
INADA Naoki
267941c675 Issue #28201: Dict reduces possibility of 2nd conflict in hash table.
Do perturb shift after first conflict.
2016-10-06 15:19:07 +09:00
Serhiy Storchaka
e036ef8fa2 Issue #27358: Optimized merging var-keyword arguments and improved error
message when pass a non-mapping as a var-keyword argument.
2016-10-02 11:06:43 +03:00
Serhiy Storchaka
97932e4c4f issue #28144: Decrease empty_keys_struct's dk_refcnt
since there is no dummy_struct any more.
Patch by Xiang Zhang.
2016-09-26 23:01:23 +03:00
Serhiy Storchaka
46825d2399 Issue #28194: Clean up some checks in dict implementation.
Patch by Xiang Zhang.
2016-09-26 21:29:34 +03:00
Raymond Hettinger
6692f01c91 merge 2016-09-18 21:46:08 -07:00
Raymond Hettinger
7eb1becc25 Issue #28189: dictitems_contains no longer swallows compare errors.
(Patch by Xiang Zhang)
2016-09-18 21:45:11 -07:00
Victor Stinner
611b0fa94c Add _PyDict_CheckConsistency()
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".
2016-09-14 15:02:01 +02:00
Victor Stinner
d0ad11f6b4 Fix _PyDict_Pop() on pending key
Issue #28120: Fix dict.pop() for splitted dictionary when trying to remove a
"pending key" (Not yet inserted in split-table).

Patch by Xiang Zhang.
2016-09-13 16:56:38 +02:00
Victor Stinner
9926480b6a Issue #28040: Cleanup find_empty_slot()
find_empty_slot() only supports combined dict
2016-09-13 09:38:29 +02:00
Victor Stinner
3c336c5915 Issue #28077: find_empty_slot() only supports combined dict 2016-09-12 14:17:40 +02:00
Serhiy Storchaka
473e0e4dba Fixed compiler warnings in compact dict implementation on 32-bit platforms. 2016-09-10 21:34:43 +03:00
Victor Stinner
990397ef1e dictobject.c: explain why stringlib is used 2016-09-09 20:22:59 -07:00
Victor Stinner
78601a38c2 Fix SystemError in compact dict
Issue #28040: Fix _PyDict_DelItem_KnownHash() and _PyDict_Pop(): convert
splitted table to combined table to be able to delete the item.

Write an unit test for the issue.

Patch by INADA Naoki.
2016-09-09 19:28:36 -07:00
Berker Peksag
71c01d43a7 Issue #28033: Fix typo in dictobject.c
Patch by Wesley Emeneker.
2016-09-09 03:57:23 +03:00
Benjamin Peterson
3c569295d6 do not worry about 64-bit dict sizes on 32-bit platforms 2016-09-08 13:16:41 -07:00
Victor Stinner
3b6a6b4215 Add a new private version to the builtin dict type
Issue #26058: Add a new private version to the builtin dict type, incremented
at each dictionary creation and at each dictionary change.

Implementation of the PEP 509.
2016-09-08 12:51:24 -07:00
Benjamin Peterson
186122ead2 access dk_indices through a union 2016-09-08 12:20:12 -07:00
Victor Stinner
a4348cc1be Add documentation to the dict implementation
Issue #27350.
2016-09-08 12:01:25 -07:00
Victor Stinner
58f7c5a955 Reindeint DK_xxx macros
Issue #27350.
2016-09-08 11:37:36 -07:00
Victor Stinner
208857ec33 dk_get_index/dk_set_index uses a type indices variable
Issue #27350.
2016-09-08 11:35:46 -07:00
Victor Stinner
dee6e252cc Split lookdict_unicode_nodummy() assertion to debug
Issue #27350.
2016-09-08 11:16:07 -07:00
Victor Stinner
71211e3386 Add assertions to dk_set_index()
Issue #27350.
2016-09-08 10:52:46 -07:00
Benjamin Peterson
003f059b3a link to canonical blogspot 2016-09-08 10:14:31 -07:00
Benjamin Peterson
7322225a57 use native inline instead of Py_LOCAL_INLINE 2016-09-08 09:58:47 -07:00
Benjamin Peterson
f0acae2d3c rearrange to make gcc happy 2016-09-08 09:50:08 -07:00
Victor Stinner
98ee9d5b73 Add Py_MEMBER_SIZE macro
Issue #27350: use Py_MEMBER_SIZE() macro to get the size of
PyDictKeyEntry.dk_indices, rather than hardcoding 8.
2016-09-08 09:33:56 -07:00
Victor Stinner
742da040db Implement compact dict
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.
2016-09-07 17:40:12 -07:00
Benjamin Peterson
55f445282d remove memory indirections in dict_traverse (closes #27956) 2016-09-05 12:12:59 -07:00
R David Murray
ce85acff3a Merge: #20647: Update dictobject.c comments to account for randomized string hashes. 2016-07-10 12:40:03 -04:00
R David Murray
537ad7ad9f #20647: Update dictobject.c comments to account for randomized string hashes.
Patch by Jaysinh Shukla.
2016-07-10 12:33:18 -04:00
Serhiy Storchaka
ab479c49d3 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka
fbb1c5ee06 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Benjamin Peterson
0f04bc7959 merge 3.5 (closes #26478) 2016-03-03 22:10:52 -08:00
Benjamin Peterson
cfc2a1fc70 merge 3.4 (closes #26478) 2016-03-03 22:08:01 -08:00
Benjamin Peterson
f11b25b081 properly use the ObjArgs variant of CallMethod in dictview binary operations (closes #26478) 2016-03-03 22:05:36 -08:00
Raymond Hettinger
ce5179fcba Issue #23601: Use small object allocator for dict key objects 2016-01-31 08:56:21 -08:00
Victor Stinner
b56837a033 Merge 3.5
Issue #26154: Add a new private _PyThreadState_UncheckedGet() function.
2016-01-20 11:19:46 +01:00
Victor Stinner
bfd316e750 Add _PyThreadState_UncheckedGet()
Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which
gets the current thread state, but don't call Py_FatalError() if it is NULL.

Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to
no more expose complex and private atomic types. Atomic types depends on the
compiler or can even depend on compiler options. The new function
_PyThreadState_UncheckedGet() allows to get the variable value without having
to care of the exact implementation of atomic types.

Changes:

* Replace direct usage of the _PyThreadState_Current variable with a call to
  _PyThreadState_UncheckedGet().
* In pystate.c, replace direct usage of the _PyThreadState_Current variable
  with the PyThreadState_GET() macro for readability.
* Document also PyThreadState_Get() in pystate.h
2016-01-20 11:12:38 +01:00
doko@ubuntu.com
3b63dc3aa9 - merge 3.5 2016-01-14 14:05:21 +01:00
doko@ubuntu.com
17210f50d2 dictobject.c(dict_sizeof): Make it static again. 2016-01-14 14:04:59 +01:00
Serhiy Storchaka
ef1585eb9a Issue #25923: Added more const qualifiers to signatures of static and private functions. 2015-12-25 20:01:53 +02:00
Serhiy Storchaka
3987e26e75 Issue #25914: Fixed and simplified OrderedDict.__sizeof__. 2015-12-22 08:22:05 +02:00
Serhiy Storchaka
0ce7a3a34c Issue #25914: Fixed and simplified OrderedDict.__sizeof__. 2015-12-22 08:16:18 +02:00
Serhiy Storchaka
a9406e77fa Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:07:11 +02:00
Serhiy Storchaka
5c4064e8bd Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Victor Stinner
b4efc963d6 Issue #25557: Refactor _PyDict_LoadGlobal()
Don't fallback to PyDict_GetItemWithError() if the hash is unknown: compute the
hash instead. Add also comments to explain the optimization a little bit.
2015-11-20 09:24:02 +01:00