From ae8f34c80d9c07f760599a8cc0a45faf0b258da6 Mon Sep 17 00:00:00 2001 From: perey Date: Sun, 15 Sep 2024 15:15:14 +0800 Subject: [PATCH] Don't match a leading, or no, underscore --- Lib/urllib/request.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index bc35d8a80e5d03..e49fc1ebb45782 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -417,6 +417,9 @@ def add_handler(self, handler): continue i = meth.find("_") + if i < 1: + # Don't match "open", "_open", etc. + continue protocol = meth[:i] condition = meth[i+1:]