]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-46032: Check types in singledispatch's register() at declaration time (GH-30050)
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 25 Dec 2021 12:16:14 +0000 (14:16 +0200)
committerGitHub <noreply@github.com>
Sat, 25 Dec 2021 12:16:14 +0000 (14:16 +0200)
commit078abb676cf759b1e960f78390b6e80f256f0255
treecd5a2e2271e099f1f5117e34d3001dce8b2c005b
parent1b30660c3b40da557050948ac8635f2dc50c4ee2
bpo-46032: Check types in singledispatch's register() at declaration time (GH-30050)

The registry() method of functools.singledispatch() functions checks now
the first argument or the first parameter annotation and raises a TypeError if it is
not supported. Previously unsupported "types" were ignored (e.g. typing.List[int])
or caused an error at calling time (e.g. list[int]).
Lib/functools.py
Lib/test/test_functools.py
Misc/NEWS.d/next/Library/2021-12-11-15-45-07.bpo-46032.HmciLT.rst [new file with mode: 0644]