summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)Victor Stinner2020-12-011-3/+3
| | | | | | | | | | | No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
* bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and ↵Serhiy Storchaka2020-10-261-1/+1
| | | | | | | | | | | _PyDict_GetItemId. (GH-22648) These functions are considered not safe because they suppress all internal errors and can return wrong result. PyDict_GetItemString and _PyDict_GetItemId can also silence current exception in rare cases. Remove no longer used _PyDict_GetItemId. Add _PyDict_ContainsId and rename _PyDict_Contains into _PyDict_Contains_KnownHash.
* bpo-40521: Empty frozenset is no longer a singleton (GH-21085)Raymond Hettinger2020-06-231-33/+5
| | | | | | | | | * Revert "bpo-40521: Make the empty frozenset per interpreter (GH-21068)" This reverts commit 261cfedf7657a515e04428bba58eba2a9bb88208. * bpo-40521: Empty frozensets are no longer singletons * Complete the removal of the frozenset singleton
* bpo-40521: Make the empty frozenset per interpreter (GH-21068)Victor Stinner2020-06-231-10/+15
| | | Each interpreter now has its own empty frozenset singleton.
* Improve code clarity for the set lookup logic (GH-20028)Raymond Hettinger2020-05-101-125/+55
|
* Remove out-of-date comment (GH-19886)Raymond Hettinger2020-05-031-2/+1
|
* Simplify set entry insertion logic. (GH-19881)Raymond Hettinger2020-05-031-16/+2
|
* bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)Victor Stinner2020-04-291-6/+0
| | | | | | | | | | | | | | | | | | | Remove the following function from the C API: * PyAsyncGen_ClearFreeLists() * PyContext_ClearFreeList() * PyDict_ClearFreeList() * PyFloat_ClearFreeList() * PyFrame_ClearFreeList() * PyList_ClearFreeList() * PySet_ClearFreeList() * PyTuple_ClearFreeList() Make these functions private, move them to the internal C API and change their return type to void. Call explicitly PyGC_Collect() to free all free lists. Note: PySet_ClearFreeList() did nothing.
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-2/+2
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-2/+1
|
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-071-0/+2
| | | | | | | | | | | | This implements things like `list[int]`, which returns an object of type `types.GenericAlias`. This object mostly acts as a proxy for `list`, but has attributes `__origin__` and `__args__` that allow recovering the parts (with values `list` and `(int,)`. There is also an approximate notion of type variables; e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`. Type variables are objects of type `typing.TypeVar`.
* bpo-37207: Use PEP 590 vectorcall to speed up frozenset() (GH-19053)Dong-hee Na2020-03-181-18/+50
|
* bpo-37207: Use PEP 590 vectorcall to speed up set() constructor (GH-19019)Dong-hee Na2020-03-161-0/+23
|
* bpo-39573: Use Py_IS_TYPE() macro to check for types (GH-18809)Andy Lester2020-03-061-1/+1
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError() (GH-18278)Victor Stinner2020-01-301-1/+1
| | | | | | | | | Add _Py_NO_RETURN to functions calling Py_FatalError(): * _PyObject_AssertFailed() * dummy_dealloc() * faulthandler_fatal_error_thread() * none_dealloc() * notimplemented_dealloc()
* bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)Serhiy Storchaka2019-09-011-2/+3
| | | Only AttributeError should be silenced.
* bpo-8425: Fast path for set inplace difference when the second set is large ↵Raymond Hettinger2019-08-291-1/+17
| | | | (GH-15590)
* Make PyXXX_Fini() functions private (GH-15531)Victor Stinner2019-08-261-1/+1
| | | | | For example, rename PyTuple_Fini() to _PyTuple_Fini(). These functions are only declared in the internal C API.
* bpo-37219: Remove erroneous optimization for differencing an empty set ↵Raymond Hettinger2019-06-111-8/+0
| | | | | | (GH-13965)
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-8/+8
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-101-2/+2
| | | | | 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.
* bpo-35444: Unify and optimize the helper for getting a builtin object. ↵Serhiy Storchaka2018-12-111-1/+2
| | | | | | | | (GH-11047) This speeds up pickling of some iterators. This fixes also error handling in pickling methods when fail to look up builtin "getattr".
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | 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
* Neaten the code without any algorithmic change. (GH-10466)Raymond Hettinger2018-11-111-5/+2
| | | Remove unneeded assertion (we already know so is a PySetObject *).
* Optimize set.pop() to advance a pointer instead of indexing. (GH-10429)Raymond Hettinger2018-11-091-7/+8
| | | | | 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.
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * 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".
* bpo-34573: Simplify __reduce__() of set and dict iterators. (GH-9050)Sergey Fedoseev2018-10-201-25/+3
| | | | Simplify the pickling of set and dictionary objects iterators by consuming the iterator into a list with PySequence_List.
* bpo-1621: Avoid signed integer overflow in set_table_resize(). (GH-9059)Sergey Fedoseev2018-09-111-8/+3
| | | | | | | | 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 -->
* bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)lekma2018-05-021-1/+3
|
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-20/+20
| | | | | | | | | (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.
* Removed unnecesssary bit inversion which doesn't improve dispersion ↵Raymond Hettinger2018-01-181-1/+1
| | | | statistics (#5235)
* bpo-26163: Frozenset hash improvement (#5194)Raymond Hettinger2018-01-161-0/+1
|
* bpo-29476: Simplify set_add_entry() (#5175)Raymond Hettinger2018-01-141-2/+2
|
* bpo-31462: Remove trailing whitespaces. (#3564)Serhiy Storchaka2017-09-141-1/+1
|
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+1
| | | | | | | * 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).
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-061-1/+0
| | | Windows buildbots started failing due to include-related errors.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-0/+1
| | | | | | | | | * 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).
* Fix terminology in comment and add more design rationale. (#3335)Raymond Hettinger2017-09-051-3/+10
| | | | | | * Fix terminology in comment and add more design rationale. * Fix extra space
* bpo-31095: fix potential crash during GC (GH-2974)INADA Naoki2017-08-241-0/+3
|
* bpo-30592: Fixed error messages for some builtins. (#1996)Serhiy Storchaka2017-06-081-2/+2
| | | | | 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.
* bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)Serhiy Storchaka2017-04-191-3/+9
| | | | | | raised an error. Replace them with using concrete types API that never fails if appropriate.
* bpo-29949: Fix set memory usage regression (GH-943)INADA Naoki2017-04-011-6/+5
| | | | | Revert "Minor factoring: move redundant resize scaling logic into the resize function." This reverts commit 4897300276d870f99459c82b937f0ac22450f0b6.
* Issue #29460: _PyArg_NoKeywords(), _PyArg_NoStackKeywords() andSerhiy Storchaka2017-02-061-3/+2
| | | | _PyArg_NoPositional() now are macros.
* Reduce load factor (from 66% to 60%) to improve effectiveness of linear probing.Raymond Hettinger2017-02-041-3/+3
| | | | | | | 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).
* Remove unnecessary variables.Raymond Hettinger2017-02-021-5/+2
| | | | | * so->used never gets changed during a resize * so->filled only changes when dummies are present and being eliminated
* Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-1/+1
| | | | dict.
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-1/+1
| | | | UTF-8 represenatation of Unicode objects.
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-1/+1
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #28071: Add early-out for differencing from an empty set.Raymond Hettinger2016-09-121-0/+8
|