Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
621d7fd5
Commit
621d7fd5
authored
Jan 06, 2016
by
Berker Peksag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #6500: Fix "maximum recursion depth exceeded" error caused by Request.__getattr__()
parent
0f3a71da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
Lib/test/test_urllib2.py
Lib/test/test_urllib2.py
+7
-0
Lib/urllib2.py
Lib/urllib2.py
+1
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urllib2.py
View file @
621d7fd5
...
...
@@ -1302,6 +1302,13 @@ class RequestTests(unittest.TestCase):
self
.
assertEqual
(
"POST"
,
self
.
post
.
get_method
())
self
.
assertEqual
(
"GET"
,
self
.
get
.
get_method
())
def
test___getattr__
(
self
):
self
.
assertEqual
(
"GET"
,
self
.
get
.
_Request__r_method
)
self
.
assertEqual
(
"http://www.python.org/~jeremy/"
,
self
.
get
.
_Request__r_full_url
)
with
self
.
assertRaises
(
AttributeError
):
self
.
get
.
_Request__r_invalid_attr
def
test_add_data
(
self
):
self
.
assertTrue
(
not
self
.
get
.
has_data
())
self
.
assertEqual
(
"GET"
,
self
.
get
.
get_method
())
...
...
Lib/urllib2.py
View file @
621d7fd5
...
...
@@ -251,8 +251,7 @@ class Request:
if attr[:12] == '_Request__r_':
name = attr[12:]
if hasattr(Request, 'get_' + name):
getattr(self, 'get_' + name)()
return getattr(self, attr)
return getattr(self, 'get_' + name)()
raise AttributeError, attr
def get_method(self):
...
...
Misc/NEWS
View file @
621d7fd5
...
...
@@ -36,6 +36,9 @@ Core and Builtins
Library
-------
- Issue #6500: Fix "maximum recursion depth exceeded" error caused
by urllib2.Request.__getattr__().
- Issue #24103: Fixed possible use after free in ElementTree.iterparse().
- Issue #20954: _args_from_interpreter_flags used by multiprocessing and some
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment