[tahoe-lafs-trac-stream] [tahoe-lafs] #1418: "cannot convert float NaN to integer" in next_power_of_k, during upload via helper

tahoe-lafs trac at tahoe-lafs.org
Mon Aug 15 17:31:11 PDT 2011


#1418: "cannot convert float NaN to integer" in next_power_of_k, during upload via
helper
------------------------+---------------------------
     Reporter:  rycee   |      Owner:  rycee
         Type:  defect  |     Status:  new
     Priority:  major   |  Milestone:  undecided
    Component:  code    |    Version:  1.8.2
   Resolution:          |   Keywords:  helper upload
Launchpad Bug:          |
------------------------+---------------------------

Comment (by davidsarah):

 Kludgy but more cross-platform way to get the FP environment (assuming
 {{{sizeof(fenv_t) <= 100}}}):
 {{{
 from ctypes import cdll, create_string_buffer
 from ctypes.util import find_library
 libm = cdll.LoadLibrary(find_library('m'))
 b = create_string_buffer(100)
 assert libm.fegetenv(b) == 0
 b.raw
 }}}
 which on my system gives
 {{{
 '\x7f\x03\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xa0\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
 }}}

 To decode the structure, see [http://linux.die.net/include/bits/fenv.h].
 Note that we probably only need to detect when it changes during a unit
 test. For that, I would try hacking the {{{run}}} method of {{{TestCase}}}
 in {{{twisted.trial.unittest}}} so that it calls {{{libm.fegetenv(b)}}}
 before and after running the test code (the {{{result.startTest(self)}}}
 line) and prints the values of {{{b.raw}}} if they are different.

-- 
Ticket URL: <http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1418#comment:29>
tahoe-lafs <http://tahoe-lafs.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list