Commit Graph

139 Commits

Author SHA1 Message Date
Hai Shi
dd39123970 bpo-40137: Convert _functools module to use PyType_FromModuleAndSpec. (GH-23405) 2020-12-29 04:45:07 -08:00
Batuhan Taskaya
044a1048ca bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)
The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions.

For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
2020-10-06 13:03:02 -07:00
Hai Shi
3ddc634cd5 bpo-40275: Use new test.support helper submodules in tests (GH-21219) 2020-06-30 15:46:06 +02:00
Pablo Galindo
2f172d8f15 bpo-17005: Move topological sort functionality to its own module (GH-20558)
The topological sort functionality that was introduced initially in the
functools module has been moved to a new graphlib module to
better accommodate the new tools and keep the original scope of the
functools module.
2020-06-01 00:41:14 +01:00
Hai Shi
e80697d687 bpo-40275: Adding threading_helper submodule in test.support (GH-20263) 2020-05-28 00:10:27 +02:00
Raymond Hettinger
21cdb711e3 bpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019) 2020-05-11 17:00:53 -07:00
Dennis Sweeney
1253c3ef70 bpo-40504: Allow weakrefs to lru_cache objects (GH-19938) 2020-05-05 14:14:32 -07: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
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
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
Pablo Galindo
8c77b8cb91 bpo-36540: PEP 570 -- Implementation (GH-12701)
This commit contains the implementation of PEP570: Python positional-only parameters.

* Update Grammar/Grammar with new typedarglist and varargslist

* Regenerate grammar files

* Update and regenerate AST related files

* Update code object

* Update marshal.c

* Update compiler and symtable

* Regenerate importlib files

* Update callable objects

* Implement positional-only args logic in ceval.c

* Regenerate frozen data

* Update standard library to account for positional-only args

* Add test file for positional-only args

* Update other test files to account for positional-only args

* Add News entry

* Update inspect module and related tests
2019-04-29 13:36:57 +01: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
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
Raymond Hettinger
d8080c0119 bpo-35780: Fix errors in lru_cache() C code (GH-11623) 2019-01-26 03:02:00 -05: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
INADA Naoki
56d8f57b83 bpo-33967: Fix wrong use of assertRaises (GH-8306) 2018-07-17 13:44:47 +09:00
Zackery Spytz
9e9b2c32a3 bpo-33967: Remove use of deprecated assertRaisesRegexp() (GH-8261)
It was added in test_functools at 445f1b3.
2018-07-12 12:57:05 +09: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
Mike
53f7a7c281 bpo-32297: Few misspellings found in Python source code comments. (#4803)
* Fix multiple typos in code comments

* Add spacing in comments (test_logging.py, test_math.py)

* Fix spaces at the beginning of comments in test_logging.py
2017-12-14 13:04:53 +02: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