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:]