summaryrefslogtreecommitdiff
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-02-24 20:55:31 +0000
committerSenthil Kumaran <orsenthil@gmail.com>2010-02-24 20:55:31 +0000
commit77f447bff1902202a28acbe22c1d7621211c0938 (patch)
tree3f5ef47cd293de7f549f49837405ab7f6cc13e26 /Lib/urllib2.py
parent1eb62dced032541ca0a08b4c06beb4cc69425b06 (diff)
downloadcpython-77f447bff1902202a28acbe22c1d7621211c0938.tar.gz
Fix for Issue7540 ; urllib2 will raise a TypeError when you try to add_data to
a existing req object already having data.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 122f777ce4..8b26971757 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -226,6 +226,9 @@ class Request:
# XXX these helper methods are lame
def add_data(self, data):
+ if self.has_data():
+ raise TypeError("Request Obj already contains data: %s" %
+ self.data)
self.data = data
def has_data(self):