diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-18 08:35:40 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-18 08:35:40 (GMT) |
commit | 43beaebffb55e0b9250d996fd7a10f6e575f34e0 (patch) | |
tree | 473b5cf8560700acf12c95512a9c16ca0d757cdd /Lib/urllib2.py | |
parent | 5e90cd9b32b1fdd1779d6cbd19530fffe26683ff (diff) | |
download | cpython-43beaebffb55e0b9250d996fd7a10f6e575f34e0.zip cpython-43beaebffb55e0b9250d996fd7a10f6e575f34e0.tar.gz cpython-43beaebffb55e0b9250d996fd7a10f6e575f34e0.tar.bz2 |
Issue #6500: Fixed infinite recursion in urllib2.Request.__getattr__().
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r-- | Lib/urllib2.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 9277b1d..8ec5e2a 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -248,11 +248,9 @@ class Request: # methods getting called in a non-standard order. this may be # too complicated and/or unnecessary. # XXX should the __r_XXX attributes be public? - if attr[:12] == '_Request__r_': - name = attr[12:] - if hasattr(Request, 'get_' + name): - getattr(self, 'get_' + name)() - return getattr(self, attr) + if attr in ('_Request__r_type', '_Request__r_host'): + getattr(self, 'get_' + attr[12:])() + return self.__dict__[attr] raise AttributeError, attr def get_method(self): |