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

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]).

(cherry picked from commit 078abb676cf759b1e960f78390b6e80f256f0255)
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]