From ffae614cda8df36bd8b5905798a09b7d84b2ff8a Mon Sep 17 00:00:00 2001 From: Eclips4 Date: Sat, 29 Oct 2022 22:00:31 +0300 Subject: [PATCH 1/2] gh-98852: Add extra type check to avoid a bug with parameterizing generics --- Lib/typing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/typing.py b/Lib/typing.py index 95bd61c7f8c61f..990fbe85ec0a12 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1440,6 +1440,8 @@ def _determine_new_args(self, args): substfunc = getattr(old_arg, '__typing_subst__', None) if substfunc: new_arg = substfunc(new_arg_by_param[old_arg]) + elif not isinstance(old_arg, (_GenericAlias, GenericAlias, types.UnionType)): + new_arg = old_arg else: subparams = getattr(old_arg, '__parameters__', ()) if not subparams: From 920c3f4453691e8618aac66f19ce0bc989a5b377 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 29 Oct 2022 19:29:36 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2022-10-29-19-29-35.gh-issue-98852.jR9qxY.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-10-29-19-29-35.gh-issue-98852.jR9qxY.rst diff --git a/Misc/NEWS.d/next/Library/2022-10-29-19-29-35.gh-issue-98852.jR9qxY.rst b/Misc/NEWS.d/next/Library/2022-10-29-19-29-35.gh-issue-98852.jR9qxY.rst new file mode 100644 index 00000000000000..c3b05c66450033 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-10-29-19-29-35.gh-issue-98852.jR9qxY.rst @@ -0,0 +1 @@ +Add extra type check in ``_determine_new_args`` to avoid a bug with parameterizing generics.