From: <am...@us...> - 2009-02-02 15:50:35
|
Revision: 6006 http://jython.svn.sourceforge.net/jython/?rev=6006&view=rev Author: amak Date: 2009-02-02 15:50:25 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Fix for bug 1258. select() semantics differ from CPython, causing pydoc HTTPd to fail http://bugs.jython.org/issue1258 Thanks to Ryan Blair for reporting the bug and providing a patch. Modified Paths: -------------- trunk/jython/Lib/pydoc.py Modified: trunk/jython/Lib/pydoc.py =================================================================== --- trunk/jython/Lib/pydoc.py 2009-02-01 08:24:06 UTC (rev 6005) +++ trunk/jython/Lib/pydoc.py 2009-02-02 15:50:25 UTC (rev 6006) @@ -1959,13 +1959,17 @@ self.callback = callback self.base.__init__(self, self.address, self.handler) - def serve_until_quit(self): - import select - self.quit = False - while not self.quit: - rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) - if rd: self.handle_request() - + def serve_until_quit(self): + import sys + if sys.platform.startswith('java'): + from select import cpython_compatible_select as select + else: + from select import select + self.quit = False + while not self.quit: + rd, wr, ex = select([self.socket], [], [], 1) + if rd: self.handle_request() + def server_activate(self): self.base.server_activate(self) if self.callback: self.callback(self) @@ -1976,7 +1980,7 @@ try: try: DocServer(port, callback).serve_until_quit() - except (KeyboardInterrupt, select.error): + except (KeyboardInterrupt, select.error): pass finally: if completer: completer() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |