Sergey Fedoseev
e5f6207ba6
bpo-34303: Micro-optimizations in functools.reduce() (GH-8598)
2019-06-01 13:32:17 -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
c145f3bfbe
bpo-36974: remove _PyObject_HasFastCall (GH-13460)
2019-05-30 12:43:58 +02:00
Jeroen Demeyer
eb65e2443a
bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)
...
Co-authored-by: Mark Shannon <mark@hotpy.org>
2019-05-28 14:42:53 +02:00
Raymond Hettinger
14adbd4598
bpo-36650: Fix handling of empty keyword args in C version of lru_cache. (GH-12881)
2019-04-20 07:20:44 -10:00
Raymond Hettinger
2dda72a2e8
lru_cache: Add more comments. Fix comment typos. Clarify a comment. (GH-11795)
2019-02-08 18:55:02 -08:00
Raymond Hettinger
ffdf1c30ab
Consistently move the misses update to just before the user function call (GH-11715)
2019-01-31 15:03:38 -08:00
Raymond Hettinger
d8080c0119
bpo-35780: Fix errors in lru_cache() C code (GH-11623)
2019-01-26 03:02:00 -05:00
Serhiy Storchaka
62be74290a
bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)
...
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-27 13:27:31 +02:00
Victor Stinner
ec13b9322d
bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)
...
Move _PyTuple_ITEMS() to a new header file:
Include/internal/pycore_tupleobject.h
2018-11-25 23:56:17 +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
Victor Stinner
d17a693fa0
bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)
...
* _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-09 16:56:48 +01: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
INADA Naoki
3070b71e5e
bpo-32422: Reduce lru_cache memory usage (GH-5008)
2017-12-26 02:03:24 +09:00
Serhiy Storchaka
4ab46d7949
bpo-31497: Add private helper _PyType_Name(). ( #3630 )
...
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-17 21:11:04 +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
INADA Naoki
a6296d34a4
bpo-31095: fix potential crash during GC (GH-2974)
2017-08-24 14:55:17 +09:00
Serhiy Storchaka
ba85d69a3e
bpo-29878: Add global instances of int for 0 and 1. ( #852 )
2017-03-30 09:09:41 +03:00
Serhiy Storchaka
3c749fc867
Simplify partial.__new__. ( #813 )
...
Fast paths in partial.__new__ no longer needed since concatenating with empty
tuple was optimized.
2017-03-25 11:10:16 +01:00
Michael Seifert
6c3d527468
bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords are not strings ( #649 )
2017-03-15 07:26:33 +02:00
Victor Stinner
0f7b0b397e
bpo-29735: Optimize partial_call(): avoid tuple ( #516 )
...
* 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-03-14 21:37:20 +01:00
Victor Stinner
561ca80cff
Document why functools.partial() must copy kwargs ( #253 )
...
Add a comment to prevent further attempts to avoid a copy for
optimization.
2017-02-23 18:26:43 +01:00
Serhiy Storchaka
9639e4ab6d
bpo-29532: Altering a kwarg dictionary passed to functools.partial() ( #190 )
...
no longer affects a partial object after creation.
2017-02-20 14:04:30 +02:00
Serhiy Storchaka
617c7753ce
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:42:20 +02:00
Serhiy Storchaka
42e1ea9a10
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:12:21 +02:00
Serhiy Storchaka
67796521dd
Issue #28969 : Fixed race condition in C implementation of functools.lru_cache.
...
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 18:34:33 +02:00
Raymond Hettinger
68191f8a9c
Backed out changeset ea064ff3c10f
2017-01-09 07:39:46 -08:00
Raymond Hettinger
9d60b94427
Sync-up lru_cache() C code with space saving feature in the Python version.
2017-01-08 19:34:28 -08:00
Raymond Hettinger
dda44682c6
Complete the merge for issue #29203
2017-01-08 18:04:30 -08:00
Raymond Hettinger
4ee39141e8
Issue #29203 : functools.lru_cache() now respects PEP 468
2017-01-08 17:28:20 -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
Victor Stinner
a5ed5f000a
Use _PyObject_CallNoArg()
...
Replace:
PyObject_CallObject(callable, NULL)
with:
_PyObject_CallNoArg(callable)
2016-12-06 18:45:50 +01:00
Yury Selivanov
0a66a1cdd6
Merge 3.6 (issue #28653 )
2016-11-09 18:56:26 -05:00
Yury Selivanov
46a02db90b
Issue #28653 : Fix a refleak in functools.lru_cache.
2016-11-09 18:55:45 -05:00
Nick Coghlan
457fc9a69e
Issue #27137 : align Python & C implementations of functools.partial
...
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-09-10 20:00:02 +10:00
Victor Stinner
f4d28d4385
Issue #27809 : partial_call() uses fast call for positional args
2016-08-23 16:22:35 +02:00
Victor Stinner
559bb6a713
Rename _PyObject_FastCall() to _PyObject_FastCallDict()
...
Issue #27809 :
* Rename _PyObject_FastCall() function to _PyObject_FastCallDict()
* Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1()
macros calling _PyObject_FastCallDict()
2016-08-22 22:48:54 +02:00
Victor Stinner
f7a4c488b5
keyobject_richcompare() now uses fast call
...
Issue #27128 : keyobject_richcompare() now calls _PyObject_FastCall() using a
small stack allocated on the C stack to avoid a temporary tuple.
2016-08-19 18:52:35 +02:00
Serhiy Storchaka
179f960d47
Issue #25455 : Fixed a crash in repr of recursive functools.partial objects.
2016-06-12 11:44:06 +03:00
Serhiy Storchaka
864b63c33f
Issue #26200 : Restored more safe usages of Py_SETREF.
2016-04-11 09:53:37 +03:00
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:45:48 +03:00
Serhiy Storchaka
3874128519
Issue #25945 : Fixed bugs in functools.partial.
...
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.
2016-02-02 18:45:17 +02:00
Serhiy Storchaka
e4d65e3aab
Issue #25447 : Copying the lru_cache() wrapper object now always works,
...
independedly from the type of the wrapped object (by returning the original
object unchanged).
2015-12-28 23:58:07 +02:00
Serhiy Storchaka
45120f272b
Issue #25447 : The lru_cache() wrapper objects now can be copied and pickled
...
(by returning the original object unchanged).
2015-10-24 09:49:56 +03:00
Serhiy Storchaka
b9d98d532c
Issue #24483 : C implementation of functools.lru_cache() now calculates key's
...
hash only once.
2015-10-02 12:47:11 +03:00
Serhiy Storchaka
374164c2f5
Issue #14373 : Fixed segmentation fault when gc.collect() is called during
...
constructing lru_cache (C implementation).
2015-07-25 12:10:21 +03:00
Serhiy Storchaka
e7070f09bc
Issue #14373 : C implementation of functools.lru_cache() now can be used with
...
methods.
2015-06-08 11:19:24 +03:00
Serhiy Storchaka
46c5611948
Backed out changeset: b0a0b9b59012
2015-05-24 21:53:49 +03:00
Larry Hastings
8252cc9832
Backed out changeset 57776eee74f2
2015-05-23 14:56:23 -07:00
Serhiy Storchaka
1c858c352b
Issue #14373 : Added C implementation of functools.lru_cache(). Based on
...
patches by Matt Joiner and Alexey Kachayev.
2015-05-23 22:42:49 +03:00