[Jython-checkins] jython: Work around absence of real fileno() on Windows in simpleHTTPServer.
jeff.allen
jython-checkins at python.org
Fri Oct 30 17:07:21 EDT 2015
https://hg.python.org/jython/rev/ff10e4d0f1c8
changeset: 7778:ff10e4d0f1c8
user: Jeff Allen <ja.py at farowl.co.uk>
date: Thu Oct 29 16:18:04 2015 +0000
summary:
Work around absence of real fileno() on Windows in simpleHTTPServer.
files:
Lib/SimpleHTTPServer.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py
--- a/Lib/SimpleHTTPServer.py
+++ b/Lib/SimpleHTTPServer.py
@@ -90,7 +90,11 @@
return None
self.send_response(200)
self.send_header("Content-type", ctype)
- fs = os.fstat(f.fileno()) if hasattr(os, 'fstat') else os.stat(path)
+ try:
+ fs = os.fstat(f.fileno())
+ except OSError, AttributeError:
+ # Jython on Windows lands here when f.fileno() is invalid
+ fs = os.stat(path)
self.send_header("Content-Length", str(fs[6]))
self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
self.end_headers()
--
Repository URL: https://hg.python.org/jython
More information about the Jython-checkins
mailing list