]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-46032: Check types in singledispatch's register() at declaration time ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 26 Dec 2021 12:23:23 +0000 (04:23 -0800)
committerGitHub <noreply@github.com>
Sun, 26 Dec 2021 12:23:23 +0000 (14:23 +0200)
commit25a12aac4de819745dfc64664ba183a5784b5a81
tree8ccba9387d1e22601ab406d2c32a9452a9592be8
parent07229054a129a72b4ffdf29252eb73c6154c0ccf
[3.9] bpo-46032: Check types in singledispatch's register() at declaration time (GH-30050) (GH-30254) (GH-30255)

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)
(cherry picked from commit 03c7449fbc7c57f5e0365f234a0b65c1dde763f2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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]