[issue11757] test_subprocess.test_communicate_timeout_large_ouput failure on select(): negative timeout?
Charles-Francois Natali
report at bugs.python.org
Sat Apr 9 20:13:32 CEST 2011
Charles-Francois Natali <neologix at free.fr> added the comment:
> Oh, I didn't know. In this case, is my commit 3664fc29e867 correct? I
> think that it is, because without the patch, subprocess may call poll()
> with a negative timeout, and so it is no more a timeout at all.
>
Yes, it looks correct.
But I think there are a couple places left where functions can be
called with a negative timeout, for example here :
1537 stdout, stderr =
self._communicate_with_select(input, endtime,
1538
orig_timeout)
1539
1540 self.wait(timeout=self._remaining_time(endtime))
or here:
1113 if self.stdout is not None:
1114 self.stdout_thread.join(self._remaining_time(endtime))
1115 if self.stdout_thread.isAlive():
Also, it might be simpler and cleaner to factorize the raising of the
TimeoutExpired exception inside _remaining_time, instead of scattering
this kind of checks around the file:
1514 remaining = self._remaining_time(endtime)
1515 if remaining <= 0:
1516 raise TimeoutExpired(self.args, timeout)
merging what's done in _check_timeout
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11757>
_______________________________________
More information about the Python-bugs-list
mailing list