From 77f447bff1902202a28acbe22c1d7621211c0938 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Wed, 24 Feb 2010 20:55:31 +0000 Subject: Fix for Issue7540 ; urllib2 will raise a TypeError when you try to add_data to a existing req object already having data. --- Lib/urllib2.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/urllib2.py') 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): -- cgit v1.2.1