summaryrefslogtreecommitdiff
path: root/Modules/_functoolsmodule.c
AgeCommit message (Collapse)AuthorLines
2020-12-07bpo-42536: GC track recycled tuples (GH-23623) (GH-23652)Brandt Bucher-0/+6
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector: - collections.OrderedDict.items - dict.items - enumerate - functools.reduce - itertools.combinations - itertools.combinations_with_replacement - itertools.permutations - itertools.product - itertools.zip_longest - zip Previously, they could have become untracked by a prior garbage collection. (cherry picked from commit 226a012d1cd61f42ecd3056c554922f359a1a35d)
2019-06-01bpo-34303: Micro-optimizations in functools.reduce() (GH-8598)Sergey Fedoseev-3/+6
2019-05-30bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer-8/+8
(GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
2019-05-30bpo-36974: remove _PyObject_HasFastCall (GH-13460)Jeroen Demeyer-2/+2
2019-05-28bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)Jeroen Demeyer-1/+2
Co-authored-by: Mark Shannon <mark@hotpy.org>
2019-04-20bpo-36650: Fix handling of empty keyword args in C version of lru_cache. ↵Raymond Hettinger-4/+3
(GH-12881)
2019-02-08lru_cache: Add more comments. Fix comment typos. Clarify a comment. (GH-11795)Raymond Hettinger-4/+25
2019-01-31Consistently move the misses update to just before the user function call ↵Raymond Hettinger-3/+5
(GH-11715)
2019-01-26bpo-35780: Fix errors in lru_cache() C code (GH-11623)Raymond Hettinger-83/+187
2018-11-27bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka-1/+1
Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
2018-11-25bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)Victor Stinner-1/+1
Move _PyTuple_ITEMS() to a new header file: Include/internal/pycore_tupleobject.h
2018-11-12bpo-35081: Rename internal headers (GH-10275)Victor Stinner-2/+2
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-09bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)Victor Stinner-3/+3
* _PyTuple_ITEMS() gives access to the tuple->ob_item field and cast the first argument to PyTupleObject*. This internal macro is only usable if Py_BUILD_CORE is defined. * Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob). * Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1].
2018-11-01bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner-2/+2
* 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".
2017-12-26bpo-32422: Reduce lru_cache memory usage (GH-5008)INADA Naoki-26/+6
2017-09-17bpo-31497: Add private helper _PyType_Name(). (#3630)Serhiy Storchaka-4/+3
This function returns the last component of tp_name after a dot. Returns tp_name itself if it doesn't contain a dot.
2017-09-07bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow-0/+2
* 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-08-24bpo-31095: fix potential crash during GC (GH-2974)INADA Naoki-1/+6
2017-03-30bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka-8/+1
2017-03-25Simplify partial.__new__. (#813)Serhiy Storchaka-8/+2
Fast paths in partial.__new__ no longer needed since concatenating with empty tuple was optimized.
2017-03-15bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords ↵Michael Seifert-1/+4
are not strings (#649)
2017-03-14bpo-29735: Optimize partial_call(): avoid tuple (#516)Victor Stinner-35/+80
* Add _PyObject_HasFastCall() * partial_call() now avoids temporary tuple to pass positional arguments if the callable supports the FASTCALL calling convention for positional arguments. * Fix also a performance regression in partial_call() if the callable doesn't support FASTCALL.
2017-02-23Document why functools.partial() must copy kwargs (#253)Victor Stinner-0/+3
Add a comment to prevent further attempts to avoid a copy for optimization.
2017-02-20bpo-29532: Altering a kwarg dictionary passed to functools.partial() (#190)Serhiy Storchaka-1/+4
no longer affects a partial object after creation.
2017-01-12Issue #28969: Fixed race condition in C implementation of functools.lru_cache.Serhiy Storchaka-21/+35
KeyError could be raised when cached function with full cache was simultaneously called from differen threads with the same uncached arguments.
2017-01-12Issue #28969: Fixed race condition in C implementation of functools.lru_cache.Serhiy Storchaka-21/+35
KeyError could be raised when cached function with full cache was simultaneously called from differen threads with the same uncached arguments.
2017-01-12Issue #28969: Fixed race condition in C implementation of functools.lru_cache.Serhiy Storchaka-21/+35
KeyError could be raised when cached function with full cache was simultaneously called from differen threads with the same uncached arguments.
2017-01-09Backed out changeset ea064ff3c10fRaymond Hettinger-6/+0
2017-01-08Sync-up lru_cache() C code with space saving feature in the Python version.Raymond Hettinger-0/+6
2017-01-08Complete the merge for issue #29203Raymond Hettinger-31/+18
2017-01-08Issue #29203: functools.lru_cache() now respects PEP 468Raymond Hettinger-31/+18
2016-12-16Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka-5/+5
dict.
2016-12-06Use _PyObject_CallNoArg()Victor Stinner-1/+1
Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable)
2016-11-09Merge 3.6 (issue #28653)Yury Selivanov-2/+6
2016-11-09Issue #28653: Fix a refleak in functools.lru_cache.Yury Selivanov-2/+6
2016-09-10Issue #27137: align Python & C implementations of functools.partialNick Coghlan-1/+1
The pure Python fallback implementation of functools.partial now matches the behaviour of its accelerated C counterpart for subclassing, pickling and text representation purposes. Patch by Emanuel Barry and Serhiy Storchaka.
2016-08-23Issue #27809: partial_call() uses fast call for positional argsVictor Stinner-12/+28
2016-08-22Rename _PyObject_FastCall() to _PyObject_FastCallDict()Victor Stinner-1/+1
Issue #27809: * Rename _PyObject_FastCall() function to _PyObject_FastCallDict() * Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1() macros calling _PyObject_FastCallDict()
2016-08-19keyobject_richcompare() now uses fast callVictor Stinner-11/+7
Issue #27128: keyobject_richcompare() now calls _PyObject_FastCall() using a small stack allocated on the C stack to avoid a temporary tuple.
2016-06-12Issue #25455: Fixed a crash in repr of recursive functools.partial objects.Serhiy Storchaka-17/+22
2016-04-11Issue #26200: Restored more safe usages of Py_SETREF.Serhiy Storchaka-3/+3
2016-04-06Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka-4/+4
2016-02-02Issue #25945: Fixed bugs in functools.partial.Serhiy Storchaka-60/+68
Fixed a crash when unpickle the functools.partial object with wrong state. Fixed a leak in failed functools.partial constructor. "args" and "keywords" attributes of functools.partial have now always types tuple and dict correspondingly.
2015-12-28Issue #25447: Copying the lru_cache() wrapper object now always works,Serhiy Storchaka-0/+16
independedly from the type of the wrapped object (by returning the original object unchanged).
2015-10-24Issue #25447: The lru_cache() wrapper objects now can be copied and pickledSerhiy Storchaka-0/+7
(by returning the original object unchanged).
2015-10-02Issue #24483: C implementation of functools.lru_cache() now calculates key'sSerhiy Storchaka-6/+20
hash only once.
2015-07-25Issue #14373: Fixed segmentation fault when gc.collect() is called duringSerhiy Storchaka-5/+6
constructing lru_cache (C implementation).
2015-06-08Issue #14373: C implementation of functools.lru_cache() now can be used withSerhiy Storchaka-1/+11
methods.
2015-05-24Backed out changeset: b0a0b9b59012Serhiy Storchaka-1/+546
2015-05-23Backed out changeset 57776eee74f2Larry Hastings-546/+1