summaryrefslogtreecommitdiffstats
path: root/Lib/wsgiref/handlers.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-06-05 06:56:51 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-06-05 06:56:51 (GMT)
commitff5cd4576f7be50ef245124971078d80786e19cb (patch)
tree8b6f4d8b2283702b427eaeef8a1959b36b504d44 /Lib/wsgiref/handlers.py
parent1b749c5ef6a319bb1b2fe679c7379ed61c907f7b (diff)
parented0425c60abe1b746b1ca5b4039984d2ad6583c4 (diff)
downloadcpython-ff5cd4576f7be50ef245124971078d80786e19cb.zip
cpython-ff5cd4576f7be50ef245124971078d80786e19cb.tar.gz
cpython-ff5cd4576f7be50ef245124971078d80786e19cb.tar.bz2
Issue #24291: Merge wsgi partial write fix from 3.5
Diffstat (limited to 'Lib/wsgiref/handlers.py')
-rw-r--r--Lib/wsgiref/handlers.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/wsgiref/handlers.py b/Lib/wsgiref/handlers.py
index acb3547..f4300b8 100644
--- a/Lib/wsgiref/handlers.py
+++ b/Lib/wsgiref/handlers.py
@@ -450,7 +450,17 @@ class SimpleHandler(BaseHandler):
self.environ.update(self.base_env)
def _write(self,data):
- self.stdout.write(data)
+ result = self.stdout.write(data)
+ if result is None or result == len(data):
+ return
+ from warnings import warn
+ warn("SimpleHandler.stdout.write() should not do partial writes",
+ DeprecationWarning)
+ while True:
+ data = data[result:]
+ if not data:
+ break
+ result = self.stdout.write(data)
def _flush(self):
self.stdout.flush()