From 9eddc25218bf9529b5d7ca2076e49c52899abb09 Mon Sep 17 00:00:00 2001 From: Bill Schnurr Date: Mon, 9 Nov 2026 14:35:24 -0700 Subject: [PATCH] [re] Add union fallback overload for escape Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- stdlib/re.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 42eb751498c0..bbfa2b333c0f 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -343,6 +343,8 @@ def subn( def escape(pattern: AnyStr) -> AnyStr: ... @overload def escape(pattern: ReadableBuffer) -> bytes: ... +@overload +def escape(pattern: str | ReadableBuffer) -> str | bytes: ... def purge() -> None: ...