SHARE
TWEET

guppy-py2.7.patch

a guest Apr 10th, 2011 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: guppy/heapy/test/test_Part.py
  2. ===================================================================
  3. --- guppy/heapy/test/test_Part.py       (revision 86)
  4. +++ guppy/heapy/test/test_Part.py       (revision 88)
  5. @@ -88,16 +88,24 @@
  6.  
  7.  class MixedCase(support.TestCase):
  8.      def test_1(self):
  9. +        import sys
  10.         x = self.iso(1, 2, 1.0, 2.0, '1', '2')
  11.         if self.allocation_behaves_as_originally:
  12. -           self.aseq(str(x), """\
  13. +            if sys.version < '2.7':
  14. +                self.aseq(str(x), """\
  15.  Partition of a set of 6 objects. Total size = 112 bytes.
  16.   Index  Count   %     Size   % Cumulative  % Kind (class / dict of class)
  17.       0      2  33       56  50        56  50 str
  18.       1      2  33       32  29        88  79 float
  19.       2      2  33       24  21       112 100 int""")
  20. -
  21. -
  22. +            else:
  23. +                self.aseq(str(x), """\
  24. +Partition of a set of 6 objects. Total size = 104 bytes.
  25. + Index  Count   %     Size   % Cumulative  % Kind (class / dict of class)
  26. +     0      2  33       48  46        48  46 str
  27. +     1      2  33       32  31        80  77 float
  28. +     2      2  33       24  23       104 100 int""")
  29. +                
  30.         for row in x.partition.get_rows():
  31.             self.assert_(row.set <= row.kind)
  32.          
  33. Index: guppy/sets/test.py
  34. ===================================================================
  35. --- guppy/sets/test.py  (revision 86)
  36. +++ guppy/sets/test.py  (revision 88)
  37. @@ -892,7 +892,7 @@
  38.             except OverflowError:
  39.                 pass
  40.             else:
  41. -               raise 'expected ValueError'
  42. +               raise 'expected OverflowError'
  43.  
  44.         tsv(bitset([maxint]), 1)
  45.         tsv(bitset([minint]), -1)
  46. Index: src/sets/bitset.c
  47. ===================================================================
  48. --- src/sets/bitset.c   (revision 86)
  49. +++ src/sets/bitset.c   (revision 88)
  50. @@ -2017,7 +2017,11 @@
  51.      int cpl = 0;
  52.      PyObject *w = 0;
  53.      
  54. -    x = _PyLong_AsScaledDouble(v, &e);
  55. +#if PY_VERSION_HEX >= 0x02070000
  56. +       x = _PyLong_Frexp(v, &e);
  57. +#else
  58. +       x = _PyLong_AsScaledDouble(v, &e);
  59. +#endif
  60.      if (x == -1 && PyErr_Occurred())
  61.        return -1;
  62.      if (x < 0) {
  63. @@ -2026,15 +2030,24 @@
  64.         w = PyNumber_Invert(v);
  65.         if (!w) return -1;
  66.         v = w;
  67. +#if PY_VERSION_HEX >= 0x02070000
  68. +       x = _PyLong_Frexp(v, &e);
  69. +#else
  70.         x = _PyLong_AsScaledDouble(v, &e);
  71. +#endif
  72.         if (x == -1 && PyErr_Occurred())
  73.           return -1;
  74.         assert(x >= 0);
  75.      }
  76. -    if (x != 0)
  77. -      num_bits = 1.0 * e * SHIFT + log(x)/log(2) + 1;
  78. +    if (x != 0) {
  79. +       num_bits = e;
  80. +#if PY_VERSION_HEX < 0x02070000
  81. +       num_bits *= SHIFT;
  82. +#endif
  83. +       num_bits += log(x)/log(2) + 1;
  84. +    }
  85.      else
  86. -      num_bits = 0;
  87. +       num_bits = 0;
  88.        
  89.      num_poses = (long)(num_bits / NyBits_N + 1);
  90.      /* fprintf(stderr, "x %f e %d num_bits %f num_poses %ld\n", x, e, num_bits, num_poses); */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top