Serhiy Storchaka
41c57b3353
bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)
Only AttributeError should be silenced.
7 years ago
Raymond Hettinger
88ea166dad
bpo-8425: Fast path for set inplace difference when the second set is large (GH-15590)
7 years ago
Victor Stinner
bed4817d52
Make PyXXX_Fini() functions private (GH-15531)
For example, rename PyTuple_Fini() to _PyTuple_Fini().
These functions are only declared in the internal C API.
7 years ago
Raymond Hettinger
1f11cf9521
bpo-37219: Remove erroneous optimization for differencing an empty set (GH-13965)
7 years ago
Jeroen Demeyer
530f506ac9
bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
7 years ago
Jeroen Demeyer
351c67416b
bpo-35983: skip trashcan for subclasses (GH-11841)
Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism.
Patch by Jeroen Demeyer.
7 years ago
Serhiy Storchaka
bb86bf4c4e
bpo-35444: Unify and optimize the helper for getting a builtin object. (GH-11047)
This speeds up pickling of some iterators.
This fixes also error handling in pickling methods when fail to
look up builtin "getattr".
7 years ago
Victor Stinner
bcda8f1d42
bpo-35081: Add Include/internal/pycore_object.h (GH-10640)
Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from
Include/objimpl.h to Include/internal/pycore_object.h.
7 years ago
Victor Stinner
621cebe81b
bpo-35081: Rename internal headers (GH-10275)
Rename Include/internal/ headers:
* pycore_hash.h -> pycore_pyhash.h
* pycore_lifecycle.h -> pycore_pylifecycle.h
* pycore_mem.h -> pycore_pymem.h
* pycore_state.h -> pycore_pystate.h
Add missing headers to Makefile.pre.in and PCbuild:
* pycore_condvar.h.
* pycore_hamt.h
* pycore_pyhash.h
7 years ago
Raymond Hettinger
f9ec1b9f52
Neaten the code without any algorithmic change. (GH-10466)
Remove unneeded assertion (we already know so is a PySetObject *).
7 years ago
Raymond Hettinger
cf5863faab
Optimize set.pop() to advance a pointer instead of indexing. (GH-10429)
Gives approx 20% speed-up using clang depending on the number of elements in the set (the less dense the set, the more the speed-up).
Uses the same entry++ logic used elsewhere in the setobject.c code.
7 years ago
Victor Stinner
27e2d1f219
bpo-35081: Add pycore_ prefix to internal header files (GH-10263)
* Rename Include/internal/ header files:
* pyatomic.h -> pycore_atomic.h
* ceval.h -> pycore_ceval.h
* condvar.h -> pycore_condvar.h
* context.h -> pycore_context.h
* pygetopt.h -> pycore_getopt.h
* gil.h -> pycore_gil.h
* hamt.h -> pycore_hamt.h
* hash.h -> pycore_hash.h
* mem.h -> pycore_mem.h
* pystate.h -> pycore_state.h
* warnings.h -> pycore_warnings.h
* PCbuild project, Makefile.pre.in, Modules/Setup: add the
Include/internal/ directory to the search paths of header files.
* Update includes. For example, replace #include "internal/mem.h"
with #include "pycore_mem.h".
7 years ago
Sergey Fedoseev
6395844e6a
bpo-34573: Simplify __reduce__() of set and dict iterators. (GH-9050)
Simplify the pickling of set and dictionary objects iterators by consuming
the iterator into a list with PySequence_List.
7 years ago
Sergey Fedoseev
6c7d67ce83
bpo-1621: Avoid signed integer overflow in set_table_resize(). (GH-9059)
Address a C undefined behavior signed integer overflow issue in set object table resizing. Our -fwrapv compiler flag and practical reasons why sets are unlikely to get this large should mean this was never an issue but it was incorrect code that generates code analysis warnings.
<!-- issue-number: [bpo-1621](https://www.bugs.python.org/issue1621 ) -->
https://bugs.python.org/issue1621
<!-- /issue-number -->
8 years ago
lekma
491bbedc20
bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)
8 years ago
Siddhesh Poyarekar
55edd0c185
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments. This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
8 years ago
Raymond Hettinger
fa78806041
Removed unnecesssary bit inversion which doesn't improve dispersion statistics ( #5235 )
8 years ago
Raymond Hettinger
b44c5169f6
bpo-26163: Frozenset hash improvement ( #5194 )
8 years ago
Raymond Hettinger
3329992e31
bpo-29476: Simplify set_add_entry() ( #5175 )
8 years ago
Serhiy Storchaka
13ad3b7a82
bpo-31462: Remove trailing whitespaces. ( #3564 )
9 years ago
Eric Snow
2ebc5ce42a
bpo-30860: Consolidate stateful runtime globals. ( #3397 )
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
9 years ago
Eric Snow
05351c1bd8
Revert "bpo-30860: Consolidate stateful runtime globals." ( #3379 )
Windows buildbots started failing due to include-related errors.
9 years ago
Eric Snow
76d5abc868
bpo-30860: Consolidate stateful runtime globals. ( #2594 )
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
9 years ago
Raymond Hettinger
64263dfd18
Fix terminology in comment and add more design rationale. ( #3335 )
* Fix terminology in comment and add more design rationale.
* Fix extra space
9 years ago
INADA Naoki
a6296d34a4
bpo-31095: fix potential crash during GC (GH-2974)
9 years ago
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.
9 years ago
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.
9 years ago
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 .
9 years ago
Serhiy Storchaka
68a001dd59
Issue #29460 : _PyArg_NoKeywords(), _PyArg_NoStackKeywords() and
_PyArg_NoPositional() now are macros.
9 years ago
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).
9 years ago
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
9 years ago
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
9 years ago
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
9 years ago
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
9 years ago
Raymond Hettinger
4103e4dfbc
Issue #28071 : Add early-out for differencing from an empty set.
10 years ago
Raymond Hettinger
8421d714d0
Removed unused initialization and the uninteresting comment.
10 years ago
Serhiy Storchaka
fa070298e9
Issue #26880 : Removed redundant checks in set.__init__.
10 years ago
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.
10 years ago
Raymond Hettinger
3625af5f21
Moved misplaced functions to the section for C API functions.
10 years ago
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.
10 years ago
Raymond Hettinger
b72e21b9ab
Speed-up construction of empty sets by approx 12-14%.
10 years ago
Raymond Hettinger
f50215412c
Add early-out for the common case where kwds is NULL (gives 1.1% speedup).
10 years ago
Benjamin Peterson
0e617e22f0
remove some copyright notices supserseded by the toplevel ones
10 years ago
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.
10 years ago
Raymond Hettinger
e4495877dd
Minor tweek. Counting down rather than up reduces register pressure.
10 years ago
Raymond Hettinger
86d322f020
Undo inadvertent line swap
10 years ago
Raymond Hettinger
5088f6005f
Hoist constant expressions (so->table and so->mask) out of the inner-loop.
10 years ago
Raymond Hettinger
66f6238fca
Add assertion to verify the pre-condition in the comments.
10 years ago
Raymond Hettinger
6019c8ced0
Issue #25629 : Move set fill/used updates out of inner loop
10 years ago
Raymond Hettinger
4148195c45
Move the active entry multiplication to later in the hash calculation
11 years ago