[issue1040026] os.times() is bogus

Malte Helmert report at bugs.python.org
Sun Feb 24 19:52:01 CET 2008


Malte Helmert added the comment:

>> I'd prefer a noisy compile error ..
>
> That would be fine if you could verify that none of the currently 
> supported platforms will be affected. I would still feel uneasy about 
> refusing to build python simply because os.times is not ported to a 
> platform.

Unless I'm missing something, your suggested one-line change fails to
compile in exactly the same cases -- if HAVE_TIMES is defined, but HZ
and sysconf unavailable -- but with a worse error message.

> HAVE_TIMES shouldn't have been #defined in the
> first place. (That is, I'd see that as a bug in
> the configure script.)

> No, defined HAVE_TIMES only tell you that the system has 'times' 
> function in the C library.  It is not intended to mean that os.times
> is implementable.

Sure, but if times is in the standard library, but its output is
uninterpretable, then there's something wrong going on that needs to be
fixed rather than swept under the rug.

> Personally, I would still prefer a one-line change that I proposed 
> above.  It is obviously better than the current smiley code and if it 
> happens to fix the platforms where errant behavior was observed, it is 
> worth applying even if theoretically it may be wrong.

You complained in msg62869 about the original patch that calling sysconf
on every call leads to an unacceptable slowdown. Your one-line patch
calls sysconf five times on each call when HZ is not defined.

_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1040026>
_____________________________________


More information about the Python-bugs-list mailing list