Nikita Sobolev
bd87a7fda0
Updates functools.py with consistent quotes (GH-18825)
...
I have noticed that `'` quotes are used everywhere except this particular case,
which was introduced in https://github.com/python/cpython/pull/18726
So, this is a trivial fix to enforce better consistency.
2020-03-10 17:32:15 -07:00
MojoVampire
469325c30e
bpo-35712: Make using NotImplemented in a boolean context issue a deprecation warning (GH-13195)
2020-03-03 20:50:17 +02:00
Hakan Çelik
217dce9ee6
bpo-39815: add cached_property to all (GH-18726)
...
Automerge-Triggered-By: @pablogsal
2020-03-01 13:01:34 -08:00
Pablo Galindo
99e6c260d6
bpo-17005: Add a class to perform topological sorting to the standard library (GH-11583)
...
Co-Authored-By: Tim Peters <tim.peters@gmail.com>
2020-01-23 15:29:52 +00:00
Manjusaka
051ff526b5
bpo-38565: add new cache_parameters method for lru_cache (GH-16916)
2019-11-11 23:30:18 -08:00
amist
336b3064d8
Doc: Fix Wikipedia link for functools.lru_cache (GH-16183)
2019-09-16 20:36:14 +02:00
Raymond Hettinger
0dac68f1e5
bpo-36743: __get__ is sometimes called without the owner argument ( #12992 )
2019-08-29 01:27:42 -07:00
Serhiy Storchaka
142566c028
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
...
Turn deprecation warnings added in 3.8 into TypeError.
2019-06-05 18:22:31 +03:00
Serhiy Storchaka
2085bd0877
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)
2019-06-01 11:00:15 +03:00
Raymond Hettinger
b821868e6d
bpo-36772 Allow lru_cache to be used as decorator without making a function call (GH-13048)
2019-05-26 11:27:35 -07:00
Lysandros Nikolaou
d673810b9d
bpo-35252: Remove FIXME from test_functools (GH-10551)
2019-05-19 15:11:20 -07:00
Serhiy Storchaka
d53cf99dca
bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)
2019-05-06 22:40:27 +03:00
Serhiy Storchaka
42a139ed88
bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)
...
Deprecated passing the following arguments as keyword arguments:
- "func" in functools.partialmethod(), weakref.finalize(),
profile.Profile.runcall(), cProfile.Profile.runcall(),
bdb.Bdb.runcall(), trace.Trace.runfunc() and
curses.wrapper().
- "function" in unittest.addModuleCleanup() and
unittest.TestCase.addCleanup().
- "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor
and concurrent.futures.ProcessPoolExecutor.
- "callback" in contextlib.ExitStack.callback(),
contextlib.AsyncExitStack.callback() and
contextlib.AsyncExitStack.push_async_callback().
- "c" and "typeid" in the create() method of multiprocessing.managers.Server
and multiprocessing.managers.SharedMemoryServer.
- "obj" in weakref.finalize().
Also allowed to pass arbitrary keyword arguments (even "self" and "func")
if the above arguments are passed as positional argument.
2019-04-01 09:16:35 +03:00
Serhiy Storchaka
da0847048a
bpo-36431: Use PEP 448 dict unpacking for merging two dicts. (GH-12553)
2019-03-27 08:02:28 +02: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
Pablo Galindo
7cd2543416
bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial (GH-9903)
...
inspect.isfunction() processes both inspect.isfunction(func) and
inspect.isfunction(partial(func, arg)) correctly but some other functions in the
inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction)
lack this functionality. This commits adds a new check in the mentioned functions
in the inspect module so they can work correctly with arbitrarily nested partial
functions.
2018-10-26 12:19:14 +01:00
madman-bob
e25d5fc18e
bpo-32321: Add pure Python fallback for functools.reduce (GH-8548)
2018-10-25 16:02:10 +02:00
Carl Meyer
d658deac60
bpo-21145: Add cached_property decorator in functools ( #6982 )
...
Robust caching of calculated properties is
harder than it looks at first glance, so add
a solid, well-tested implementation to the
standard library.
2018-08-28 17:11:56 +10:00
Dong-hee Na
445f1b35ce
bpo-33967: Fix singledispatch raised IndexError when no args (GH-8184)
2018-07-10 16:26:36 +09:00
Ethan Smith
c651275afe
bpo-32380: Create functools.singledispatchmethod ( #6306 )
2018-05-26 13:38:33 -07:00
Łukasz Langa
e56975351b
bpo-32227: functools.singledispatch supports registering via type annotations ( #4733 )
2017-12-11 13:56:31 -08:00
INADA Naoki
9811e80fd0
bpo-31581: Reduce the number of imports for functools (GH-3757)
2017-09-30 16:13:02 +09:00
Antoine Pitrou
a6a4dc816d
bpo-31370: Remove support for threads-less builds ( #3385 )
...
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Raymond Hettinger
15ce0bee97
Conceptually, roots is a set. Also searching it as a set is a tiny bit faster ( #3338 )
2017-09-05 09:40:44 -07:00
Raymond Hettinger
550370957c
Add comment to explain the implications of not sorting keywords ( #3331 )
...
In Python 3.6, sorted() was removed from _make_key() for the lru_cache and instead rely on guaranteed keyword argument order preservation. This makes keyword argument handling faster but it also causes multiple callers with a different keyword argument order to be cached as separate items. Depending on your point of view, this is either a performance regression (increased number of cache misses) or a performance enhancement (faster computation of keys).
2017-09-04 17:47:53 -07:00
Raymond Hettinger
ac7c5acf9b
merge
2017-01-08 17:29:21 -08:00
Raymond Hettinger
4ee39141e8
Issue #29203 : functools.lru_cache() now respects PEP 468
2017-01-08 17:28:20 -08:00
Raymond Hettinger
b2d4b3d415
Issue #28991 : Address comment that the __len__ call looked unattractive
2016-12-16 14:59:37 -08:00
Raymond Hettinger
c28dbd0452
merge
2016-12-16 13:59:32 -08:00
Raymond Hettinger
af56e0e70f
Issue #28991 : Fix obscure reentrancy bug in functools.lru_cache().
2016-12-16 13:57:40 -08: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
Serhiy Storchaka
ce2295def3
Removed redundant call of update_wrapper().
2015-10-24 09:51:53 +03:00
Yury Selivanov
77a8cd65be
Issue #23572 : Fixed functools.singledispatch on classes with falsy metaclasses.
...
Patch by Ethan Furman.
2015-08-18 14:20:00 -04: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
Serhiy Storchaka
ba9ac5b5c4
Issue #16261 : Converted some bare except statements to except statements
...
with specified exception type. Original patch by Ramchandra Apte.
2015-05-20 10:33:40 +03:00
Raymond Hettinger
ffcd8490d0
Reduce the overhead in functools.total_ordering by localizing NotImplemented.
...
(Sugguested by Serhiy Storchaka)
2015-05-12 21:26:37 -07:00
Alexander Belopolsky
e49af34151
Issue #7830 : Flatten nested functools.partial.
2015-03-01 15:08:17 -05:00
Serhiy Storchaka
08448a1f4d
Issue #23326 : Removed __ne__ implementations. Since fixing default __ne__
...
implementation in issue #21408 they are redundant.
2015-01-31 12:05:05 +02:00
Raymond Hettinger
1a8ada89f9
No need to rebuild a constant dictionary on every call. Move convert mapping to module level.
2015-01-13 22:57:35 -08:00
Raymond Hettinger
e5db863c22
Minor speed-up. Use local variable instead of a global lookup.
2015-01-06 22:16:10 -08:00
Raymond Hettinger
57a3786a62
merge
2015-01-05 22:00:08 -08:00
Raymond Hettinger
0603d3049e
Issue #23132 : Mitigate regression in speed and clarity in functools.total_ordering.
2015-01-05 21:52:10 -08:00
Serhiy Storchaka
697a526fa1
Issue #23132 : Improve performance and introspection support of comparison
...
methods created by functool.total_ordering.
2015-01-01 15:23:12 +02:00
Raymond Hettinger
92c7b90148
merge
2014-08-12 12:45:28 -07:00
Raymond Hettinger
4d58897fdb
Issue 22184: Early detection and reporting of missing lru_cache parameters
2014-08-12 12:44:52 -07:00
Serhiy Storchaka
521e5860a5
Issue #22032 : __qualname__ instead of __name__ is now always used to format
...
fully qualified class names of Python implemented classes.
2014-07-22 15:00:37 +03:00
Victor Stinner
7fa767e517
Issue #20976 : pyflakes: Remove unused imports
2014-03-20 09:16:38 +01:00