Commit Graph

100 Commits

Author SHA1 Message Date
Martin Panter 536d70ed33 Fix grammar, typos and markup in documentation and code comments
* Indent versionchanged at method level, not class level
* Mark up ``--help`` to avoid generating an en dash
* Use forward slash in Unix command line with a dollar sign ($) prompt
2017-01-14 08:23:08 +00:00
Serhiy Storchaka 5ab81d787f Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. 2016-12-16 16:18:57 +02:00
INADA Naoki ba6097734d Issue #28818: Simplify lookdict functions 2016-12-07 20:41:42 +09:00
Victor Stinner f17c3de263 Use _PyObject_CallNoArg()
Replace:
    PyObject_CallFunctionObjArgs(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Victor Stinner de4ae3d486 Backed out changeset b9c9691c72c5
Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner 27580c1fb5 Replace PyObject_CallFunctionObjArgs() with fastcall
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)

PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.

_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.

This change is part of the fastcall project. The change on listsort() is
related to the issue #23507.
2016-12-01 14:43:22 +01:00
Serhiy Storchaka b7d14a09c2 Merge from 3.5. 2016-10-30 17:25:45 +02:00
Serhiy Storchaka 0438683939 Backed out changeset 9f7505019767 (issue #27275). 2016-10-30 17:17:24 +02:00
Serhiy Storchaka 1faf9025b5 Issue #27275: Fixed implementation of pop() and popitem() methods in
subclasses of accelerated OrderedDict.
2016-10-25 15:36:56 +03:00
Serhiy Storchaka 4832580596 Issue #27275: Fixed implementation of pop() and popitem() methods in
subclasses of accelerated OrderedDict.
2016-10-25 15:33:23 +03:00
Eric Snow 06aed90a1f Issue #27576: Fix call order in OrderedDict.__init__(). 2016-09-09 11:59:08 -07:00
Eric Snow 4f29e75289 Issue #24254: Drop cls.__definition_order__. 2016-09-08 15:11:11 -07:00
Benjamin Peterson ee178e6d6e fix spelling 2016-09-08 11:08:30 -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
Eric Snow 92a6c170e6 Issue #24254: Preserve class attribute definition order. 2016-09-05 14:50:11 -07:00
Martin Panter 02b75abf73 Merge spelling and grammar fixes from 3.5 2016-08-05 01:51:39 +00:00
Martin Panter 69332c1a64 Fix spelling and grammar in documentation and code comments 2016-08-04 13:07:31 +00:00
Victor Stinner e18719509f odict: Remove useless ";" after function definition
Fix a "gcc -pendatic" warning.
2016-06-08 10:18:18 +02:00
Serhiy Storchaka d2962f145a Issue #25949: __dict__ for an OrderedDict instance is now created only when
needed.
2016-02-08 16:39:05 +02:00
Serhiy Storchaka d205d0145c Issue #25935: Garbage collector now breaks reference loops with OrderedDict. 2016-01-19 14:46:25 +02:00
Serhiy Storchaka 0ce7a3a34c Issue #25914: Fixed and simplified OrderedDict.__sizeof__. 2015-12-22 08:16:18 +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
Serhiy Storchaka 19a70e7f5d Issue #25462: The hash of the key now is calculated only once in most
operations in C implementation of OrderedDict.
2015-11-13 14:48:36 +02:00
Serhiy Storchaka 97f46db904 Issue #25410: Made testing that od_fast_nodes and dk_entries are in sync more
reliable.
2015-11-06 12:00:03 +02:00
Serhiy Storchaka d5f353ec8d Issue #24726: Revert setting the value on the dict if
_odict_add_new_node() fails.
2015-11-06 11:07:11 +02:00
Serhiy Storchaka 9c967611e3 Issue #25558: Refactoring OrderedDict iteration. 2015-11-06 10:39:51 +02:00
Serhiy Storchaka 710cd34bdb Issue #25449: Fixed a crash and leaking NULL in repr() of OrderedDict that
was mutated by direct calls of dict methods.
2015-11-04 22:33:07 +02:00
Serhiy Storchaka b45b7b2137 Issue #25449: Iterating OrderedDict with keys with unstable hash now raises
KeyError in C implementations as well as in Python implementation.

Added tests for OrderedDict subclasses.
2015-11-04 22:05:38 +02:00
Serhiy Storchaka 14eefe353e Issue #25395: Fixed crash when highly nested OrderedDict structures were
garbage collected.
2015-11-01 16:12:34 +02:00
Serhiy Storchaka 4575beba4b Issue #25410: C implementation of OrderedDict now uses type(self) instead of
self.__class__ in __repr__() and __reduce__() for simplicity and reliability.
2015-10-22 20:18:24 +03:00
Serhiy Storchaka d17427b7bd Issue #25410: Fixed a memory leak in OrderedDict in the case when key's hash
calculation fails.
2015-10-20 18:21:48 +03:00
Serhiy Storchaka 8003bafd7f Issue #25410: Cleaned up and fixed minor bugs in C implementation of OrderedDict. 2015-10-18 09:53:17 +03:00
Serhiy Storchaka 992ec46acc Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end()
that caused segmentation fault or hang in iterating after moving several
items to the start of ordered dict.
2015-10-14 19:21:24 +03:00
Victor Stinner 4a0d1e7c36 odictobject.c: fix compiler warning
PyObject_Length() returns a P_ssize_t, not an int. Use a Py_ssize_t to avoid
overflow.
2015-09-18 13:44:11 +02:00
Victor Stinner ca30b02abe Issue #24992: Fix error handling and a race condition (related to garbage
collection) in collections.OrderedDict constructor.

Patch reviewed by Serhiy Storchaka.
2015-09-03 17:50:04 +02:00
Eric Snow 8c7f9558eb Issue #24667: Resize odict in all cases that the underlying dict resizes. 2015-08-07 17:45:12 -06:00
Benjamin Peterson 0718de9770 repair my irrational excuberance 2015-06-07 00:00:42 -05:00
Benjamin Peterson 99e96f2bb0 remove unnecessary braces and indentation 2015-06-06 23:20:32 -05:00
Benjamin Peterson 2ad80f53c1 fix refleak when keys() fails 2015-06-04 14:34:20 -05:00
Eric Snow 4fabf02633 Issue #24369: Defend against key-changes during iteration. 2015-06-04 00:09:56 -06:00
Eric Snow db4061cb9d Issue #24377: Fix a ref leak in OrderedDict.__repr__. 2015-06-03 11:09:48 -06:00
Eric Snow 4c72918a59 Issue #24362: Simplify the C OrderedDict fast nodes resize logic. 2015-06-03 10:50:37 -06:00
Eric Snow ac02ef373f Issue #24368: Support keyword arguments in OrderedDict methods. 2015-06-02 20:42:14 -06:00
Eric Snow b952ab43f2 Issue #24359: Check for changed OrderedDict size during iteration. 2015-06-01 23:35:13 -06:00
Eric Snow d171975609 Issue #24348: Drop superfluous increfs/decrefs. 2015-06-01 23:12:13 -06:00
Eric Snow a762af74b2 Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. 2015-06-01 22:59:08 -06:00
Eric Snow e3dfa9e5ce Issue #16991: Fix a few leaks and other memory-related concerns in OrderedDict. 2015-05-30 12:51:15 -06:00
Eric Snow 67fb92e8c6 Issue #16991: Do not return None from OrderedDict.__reversed__. 2015-05-30 11:43:36 -06:00
Eric Snow c5e59609ac Issue #16991: Properly handle return values in several places. 2015-05-30 11:28:56 -06:00
Eric Snow 96c6af9b20 Issue #16991: Add a C implementation of collections.OrderedDict. 2015-05-29 22:21:39 -06:00