From: <am...@us...> - 2008-12-18 17:43:39
|
Revision: 5777 http://jython.svn.sourceforge.net/jython/?rev=5777&view=rev Author: amak Date: 2008-12-18 17:43:35 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Restoring an important line that got lost back r3251, which checked if the object passed to _getselectable() was actually already a SelectableChannel. Added unit test to explicitly check for same. This was illustrated by a failure in the telnetlib module, as reported in http://bugs.jython.org/issue1211 Modified Paths: -------------- branches/Release_2_2maint/jython/Lib/select.py branches/Release_2_2maint/jython/Lib/test/test_select.py Modified: branches/Release_2_2maint/jython/Lib/select.py =================================================================== --- branches/Release_2_2maint/jython/Lib/select.py 2008-12-18 11:05:16 UTC (rev 5776) +++ branches/Release_2_2maint/jython/Lib/select.py 2008-12-18 17:43:35 UTC (rev 5777) @@ -43,6 +43,8 @@ POLLNVAL = 32 def _getselectable(selectable_object): + if isinstance(selectable_object, java.nio.channels.SelectableChannel): + return selectable_object for method in ['getchannel', 'fileno']: try: channel = getattr(selectable_object, method)() Modified: branches/Release_2_2maint/jython/Lib/test/test_select.py =================================================================== --- branches/Release_2_2maint/jython/Lib/test/test_select.py 2008-12-18 11:05:16 UTC (rev 5776) +++ branches/Release_2_2maint/jython/Lib/test/test_select.py 2008-12-18 17:43:35 UTC (rev 5777) @@ -181,6 +181,17 @@ else: self.fail("Registering blocking socket should have raised select.error") + def testSelectOnSocketFileno(self): + self.cli_conn = self.serv.accept() + + def _testSelectOnSocketFileno(self): + self.cli.connect( (test_socket.HOST, test_socket.PORT) ) + self.cli.setblocking(0) + try: + rfd, wfd, xfd = select.select([self.cli.fileno()], [], [], 1) + except Exception, x: + self.fail("Selecting on socket.fileno() should not have raised exception: %s" % str(x)) + class TestPipes(unittest.TestCase): verbose = 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |