Serhiy Storchaka
6cca5c8459
bpo-30592: Fixed error messages for some builtins. ( #1996 )
...
Error messages when pass keyword arguments to some builtins that
don't support keyword arguments contained double parenthesis: "()()".
The regression was introduced by bpo-30534.
2017-06-08 14:41:19 +03:00
Serhiy Storchaka
bf623ae884
bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() ( #1096 )
...
raised an error.
Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
INADA Naoki
e82cf8675b
bpo-29949: Fix set memory usage regression (GH-943)
...
Revert "Minor factoring: move redundant resize scaling logic into the resize function."
This reverts commit 4897300276
.
2017-04-01 17:20:25 +09:00
Serhiy Storchaka
68a001dd59
Issue #29460 : _PyArg_NoKeywords(), _PyArg_NoStackKeywords() and
...
_PyArg_NoPositional() now are macros.
2017-02-06 10:41:46 +02:00
Raymond Hettinger
5cd87a8d61
Reduce load factor (from 66% to 60%) to improve effectiveness of linear probing.
...
Decreased density gives better collision statistics (average of 2.5 probes in a
full table versus 3.0 previously) and fewer occurences of starting a second
possibly overlapping sequence of 10 linear probes. Makes resizes a little more
frequent but each with less work (fewer insertions and fewer collisions).
2017-02-04 02:43:42 -08:00
Raymond Hettinger
e1af6964b4
Remove unnecessary variables.
...
* so->used never gets changed during a resize
* so->filled only changes when dummies are present and being eliminated
2017-02-02 08:24:48 -08: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
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Raymond Hettinger
4103e4dfbc
Issue #28071 : Add early-out for differencing from an empty set.
2016-09-11 22:02:28 -07:00
Raymond Hettinger
8421d714d0
Removed unused initialization and the uninteresting comment.
2016-04-29 01:37:05 -07:00
Serhiy Storchaka
fa070298e9
Issue #26880 : Removed redundant checks in set.__init__.
2016-04-29 11:31:52 +03: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
Raymond Hettinger
3625af5f21
Moved misplaced functions to the section for C API functions.
2016-03-27 01:15:07 -07:00
Raymond Hettinger
2c257ab0f8
Responsibility for argument checking belongs in set.__init__() rather than set.__new__().
...
See dict.__new__() and list.__new__() for comparison. Neither of those examine or touch
args or kwds. That work is done in the __init__() methods.
2016-03-26 04:10:11 -07:00
Raymond Hettinger
b72e21b9ab
Speed-up construction of empty sets by approx 12-14%.
2016-03-25 02:29:59 -07:00
Raymond Hettinger
f50215412c
Add early-out for the common case where kwds is NULL (gives 1.1% speedup).
2016-02-04 02:46:16 -08:00
Benjamin Peterson
3e47a1337c
merge 3.5
2016-01-01 11:56:35 -06:00
Benjamin Peterson
4e3dd51396
merge 3.4
2016-01-01 11:56:16 -06:00
Benjamin Peterson
630329e4ea
merge 3.3
2016-01-01 11:55:47 -06:00
Benjamin Peterson
0e617e22f0
remove some copyright notices supserseded by the toplevel ones
2016-01-01 11:53:47 -06: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
Raymond Hettinger
e4495877dd
Minor tweek. Counting down rather than up reduces register pressure.
2015-12-15 00:42:30 -08:00
Raymond Hettinger
86d322f020
Undo inadvertent line swap
2015-12-13 19:27:17 -08:00
Raymond Hettinger
5088f6005f
Hoist constant expressions (so->table and so->mask) out of the inner-loop.
2015-12-13 18:45:01 -08:00
Raymond Hettinger
66f6238fca
Add assertion to verify the pre-condition in the comments.
2015-11-17 20:58:43 -08:00
Raymond Hettinger
6019c8ced0
Issue #25629 : Move set fill/used updates out of inner loop
2015-11-17 08:28:07 -08:00
Raymond Hettinger
4148195c45
Move the active entry multiplication to later in the hash calculation
2015-08-07 00:43:39 -07:00
Raymond Hettinger
b501a27ad8
Restore frozenset hash caching removed in cf707dd190a9
2015-08-06 22:15:22 -07:00
Raymond Hettinger
a286a51ae1
Fix comment typo
2015-08-01 11:07:11 -07:00
Raymond Hettinger
36c0500990
Tweak the comments
2015-08-01 10:57:42 -07:00
Raymond Hettinger
fbffdef47d
Issue #24762 : Speed-up frozenset_hash() and greatly beef-up the comments.
2015-08-01 09:53:00 -07:00
Raymond Hettinger
daffc916aa
Issue #24681 : Move the most likely test first in set_add_entry().
2015-07-31 07:58:56 -07:00
Raymond Hettinger
70559b5c20
Issue #24681 : Move the store of so->table to the code block where it is used.
2015-07-23 07:42:23 -04:00
Raymond Hettinger
ff9e18a863
Issue #24583 : Consolidate previous set object updates into a single function
...
with a single entry point, named exit points at the bottom, more self-evident
refcount adjustments, and a comment describing why the pre-increment was
necessary at all.
2015-07-20 07:34:05 -04:00
Raymond Hettinger
482c05cbb5
Issue #24583 : Fix refcount leak.
2015-07-20 01:23:32 -04:00
Raymond Hettinger
061091a7c5
Issue #24583 : Fix crash when set is mutated while being updated.
2015-07-15 23:54:02 -07:00
Raymond Hettinger
d702044bcd
merge
2015-07-15 23:52:29 -07:00
Raymond Hettinger
a3626bc5bd
Issue #24583 : Fix crash when set is mutated while being updated.
2015-07-15 23:50:14 -07:00
Raymond Hettinger
5d2385ff6f
Neaten-up a little bit.
2015-07-08 11:52:27 -07:00
Raymond Hettinger
9632a7d735
Issue 24581: Revert c9782a9ac031 pending a stronger test for mutation during iteration.
2015-07-07 15:29:24 -07:00
Raymond Hettinger
11ce8e6c37
Minor bit of factoring-out common code.
2015-07-06 19:08:49 -07:00
Raymond Hettinger
3dbc11cadd
Tighten-up code in the set iterator to use an entry pointer rather than indexing.
2015-07-06 19:03:01 -07:00
Raymond Hettinger
ef6bd7d963
Tighten-up code in set_next() to use an entry pointer rather than indexing.
2015-07-06 08:43:37 -07:00
Raymond Hettinger
b48d6a63ff
Bring related functions add/contains/discard together in the code.
2015-07-05 16:27:44 -07:00
Raymond Hettinger
73799b181e
Change add/contains/discard calls to pass the key and hash instead of an entry struct.
2015-07-05 16:06:10 -07:00
Raymond Hettinger
dc28d5a198
Clean-up call patterns for add/contains/discard to better match the caller's needs.
2015-07-05 10:03:20 -07:00
Raymond Hettinger
ac2ef65c32
Make the unicode equality test an external function rather than in-lining it.
...
The real benefit of the unicode specialized function comes from
bypassing the overhead of PyObject_RichCompareBool() and not
from being in-lined (especially since there was almost no shared
data between the caller and callee). Also, the in-lining was
having a negative effect on code generation for the callee.
2015-07-04 16:04:44 -07:00