[issue1040026] os.times() is bogus

Malte Helmert report at bugs.python.org
Sun Oct 19 01:32:04 CEST 2008


Malte Helmert <helmert at informatik.uni-freiburg.de> added the comment:

Martin,

compilation indeed breaks if sysconf is available but _SC_CLK_TCK is
not. My Unix-foo is not sufficient to confidently say that this is
impossible, so my suggestion is to add defined(_SC_CLK_TCK) to the
condition of this #ifdef branch. For what it's worth, this also appears
to be the way Perl does it (perl.c, lines 384-385):

  #if defined(HAS_SYSCONF) && defined(_SC_CLK_TCK) && !defined(__BEOS__)
      PL_clocktick = sysconf(_SC_CLK_TCK);

In the other case you mention, where neither sysconf nor HZ are
available, the old default of 60 could be used instead. A noisy error
appears safer to me to avoid future similar bugs, but I see that this is
a bad idea for Python 2.5.x.

I'll prepare a modified patch.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1040026>
_______________________________________


More information about the Python-bugs-list mailing list