Raymond Hettinger
1f11cf9521
bpo-37219: Remove erroneous optimization for differencing an empty set (GH-13965)
2019-06-11 01:15:24 -07:00
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
2019-05-30 19:13:39 -07:00
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.
2019-05-10 19:21:10 +02:00
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".
2018-12-11 08:28:18 +02:00
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.
2018-11-21 22:27:47 +01:00
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
2018-11-12 16:53:38 +01:00
Raymond Hettinger
f9ec1b9f52
Neaten the code without any algorithmic change. (GH-10466)
...
Remove unneeded assertion (we already know so is a PySetObject *).
2018-11-11 14:35:47 -08:00
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.
2018-11-09 02:31:56 -08:00
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".
2018-11-01 00:52:28 +01:00
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.
2018-10-20 01:43:33 +01:00
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 -->
2018-09-11 16:18:01 -07:00
lekma
491bbedc20
bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)
2018-05-02 18:29:10 +09:00
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.
2018-04-29 21:59:33 +03:00
Raymond Hettinger
fa78806041
Removed unnecesssary bit inversion which doesn't improve dispersion statistics ( #5235 )
2018-01-18 13:23:27 -08:00
Raymond Hettinger
b44c5169f6
bpo-26163: Frozenset hash improvement ( #5194 )
2018-01-16 01:30:26 -08:00
Raymond Hettinger
3329992e31
bpo-29476: Simplify set_add_entry() ( #5175 )
2018-01-14 10:20:13 -08:00
Serhiy Storchaka
13ad3b7a82
bpo-31462: Remove trailing whitespaces. ( #3564 )
2017-09-14 09:38:36 +03:00
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).
2017-09-07 23:51:28 -06:00
Eric Snow
05351c1bd8
Revert "bpo-30860: Consolidate stateful runtime globals." ( #3379 )
...
Windows buildbots started failing due to include-related errors.
2017-09-05 21:43:08 -07:00
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).
2017-09-05 18:26:16 -07:00
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
2017-09-04 18:54:16 -07:00
INADA Naoki
a6296d34a4
bpo-31095: fix potential crash during GC (GH-2974)
2017-08-24 14:55:17 +09:00
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