Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-bitarray for openSUSE:Factory 
checked in at 2023-06-26 18:15:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-bitarray (Old)
 and      /work/SRC/openSUSE:Factory/.python-bitarray.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-bitarray"

Mon Jun 26 18:15:40 2023 rev:19 rq:1095233 version:2.7.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-bitarray/python-bitarray.changes  
2023-06-12 15:26:51.051193781 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-bitarray.new.15902/python-bitarray.changes   
    2023-06-26 18:15:43.398371587 +0200
@@ -1,0 +2,6 @@
+Sun Jun 25 19:01:34 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 2.7.6:
+  * remove caching hash value
+
+-------------------------------------------------------------------

Old:
----
  bitarray-2.7.5.tar.gz

New:
----
  bitarray-2.7.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-bitarray.spec ++++++
--- /var/tmp/diff_new_pack.f8Y1UC/_old  2023-06-26 18:15:44.110374750 +0200
+++ /var/tmp/diff_new_pack.f8Y1UC/_new  2023-06-26 18:15:44.118374785 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-bitarray
-Version:        2.7.5
+Version:        2.7.6
 Release:        0
 Summary:        Efficient Arrays of Booleans
 License:        Python-2.0

++++++ bitarray-2.7.5.tar.gz -> bitarray-2.7.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/CHANGE_LOG 
new/bitarray-2.7.6/CHANGE_LOG
--- old/bitarray-2.7.5/CHANGE_LOG       2023-06-10 21:56:55.000000000 +0200
+++ new/bitarray-2.7.6/CHANGE_LOG       2023-06-24 23:18:21.000000000 +0200
@@ -1,3 +1,8 @@
+2023-06-24   2.7.6:
+-------------------
+  * remove caching hash value, fixes issue #201
+
+
 2023-06-10   2.7.5:
 -------------------
   * fix for pypy3.9-v7.3.11, #198 (fixes #188)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/README.rst 
new/bitarray-2.7.6/README.rst
--- old/bitarray-2.7.5/README.rst       2023-06-10 21:56:55.000000000 +0200
+++ new/bitarray-2.7.6/README.rst       2023-06-24 23:18:21.000000000 +0200
@@ -63,7 +63,7 @@
 
     $ python -c 'import bitarray; bitarray.test()'
     bitarray is installed in: /Users/ilan/bitarray/bitarray
-    bitarray version: 2.7.5
+    bitarray version: 2.7.6
     sys.version: 3.11.0 (main, Oct 25 2022) [Clang 14.0.4]
     sys.prefix: /Users/ilan/Mini3/envs/py311
     pointer size: 64 bit
@@ -407,7 +407,7 @@
 Reference
 =========
 
-bitarray version: 2.7.5 -- `change log 
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
+bitarray version: 2.7.6 -- `change log 
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
 
 In the following, ``item`` and ``value`` are usually a single bit -
 an integer 0 or 1.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/bitarray/__init__.py 
new/bitarray-2.7.6/bitarray/__init__.py
--- old/bitarray-2.7.5/bitarray/__init__.py     2023-06-10 21:56:55.000000000 
+0200
+++ new/bitarray-2.7.6/bitarray/__init__.py     2023-06-24 23:18:21.000000000 
+0200
@@ -35,13 +35,9 @@
 
     def __hash__(self):
         "Return hash(self)."
-        try:
-            return self._hash
-        except AttributeError:
-            # ensure hash is independent of endianness
-            a = self if self.endian() == 'big' else bitarray(self, 'big')
-            self._hash = hash((len(a), a.tobytes()))
-            return self._hash
+        # ensure hash is independent of endianness
+        a = self if self.endian() == 'big' else bitarray(self, 'big')
+        return hash((len(a), a.tobytes()))
 
     # Technically the code below is not necessary, as all these methods will
     # raise a TypeError on read-only memory.  However, with a different error
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/bitarray/_bitarray.c 
new/bitarray-2.7.6/bitarray/_bitarray.c
--- old/bitarray-2.7.5/bitarray/_bitarray.c     2023-06-10 21:56:55.000000000 
+0200
+++ new/bitarray-2.7.6/bitarray/_bitarray.c     2023-06-24 23:18:21.000000000 
+0200
@@ -2237,32 +2237,32 @@
     return 0;
 }
 
-#define BITWISE_FUNC(name, inplace, ostr)                    \
-static PyObject *                                            \
-bitarray_ ## name (PyObject *self, PyObject *other)          \
-{                                                            \
-    PyObject *res;                                           \
-                                                             \
-    if (bitwise_check(self, other, ostr) < 0)                \
-        return NULL;                                         \
-    if (inplace) {                                           \
-        RAISE_IF_READONLY(self, NULL);                       \
-        res = self;                                          \
-        Py_INCREF(res);                                      \
-    }                                                        \
-    else {                                                   \
-        res = bitarray_copy((bitarrayobject *) self);        \
-        if (res == NULL)                                     \
-            return NULL;                                     \
-    }                                                        \
-    bitwise((bitarrayobject *) res,                          \
-            (bitarrayobject *) other, *ostr);                \
-    return res;                                              \
+#define BITWISE_FUNC(name, inplace, ostr)              \
+static PyObject *                                      \
+bitarray_ ## name (PyObject *self, PyObject *other)    \
+{                                                      \
+    PyObject *res;                                     \
+                                                       \
+    if (bitwise_check(self, other, ostr) < 0)          \
+        return NULL;                                   \
+    if (inplace) {                                     \
+        RAISE_IF_READONLY(self, NULL);                 \
+        res = self;                                    \
+        Py_INCREF(res);                                \
+    }                                                  \
+    else {                                             \
+        res = bitarray_copy((bitarrayobject *) self);  \
+        if (res == NULL)                               \
+            return NULL;                               \
+    }                                                  \
+    bitwise((bitarrayobject *) res,                    \
+            (bitarrayobject *) other, *ostr);          \
+    return res;                                        \
 }
 
-BITWISE_FUNC(and, 0, "&")    /* bitarray_and */
-BITWISE_FUNC(or,  0, "|")    /* bitarray_or  */
-BITWISE_FUNC(xor, 0, "^")    /* bitarray_xor */
+BITWISE_FUNC(and,  0, "&")   /* bitarray_and */
+BITWISE_FUNC(or,   0, "|")   /* bitarray_or  */
+BITWISE_FUNC(xor,  0, "^")   /* bitarray_xor */
 BITWISE_FUNC(iand, 1, "&=")  /* bitarray_iand */
 BITWISE_FUNC(ior,  1, "|=")  /* bitarray_ior  */
 BITWISE_FUNC(ixor, 1, "^=")  /* bitarray_ixor */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/bitarray/_util.c 
new/bitarray-2.7.6/bitarray/_util.c
--- old/bitarray-2.7.5/bitarray/_util.c 2023-06-10 21:56:55.000000000 +0200
+++ new/bitarray-2.7.6/bitarray/_util.c 2023-06-24 23:18:21.000000000 +0200
@@ -57,6 +57,18 @@
     return res;
 }
 
+/* Starting from word index `i`, count the remaining population in bitarray
+   buffer.  Equivalent to:  a[64 * i:].count()  */
+static Py_ssize_t
+count_from_word(bitarrayobject *a, Py_ssize_t i)
+{
+    assert(i >= 0);
+    if (64 * i >= a->nbits)
+        return 0;
+
+    return popcnt_words(WBUFF(a) + i, a->nbits / 64 - i) + popcnt_64(zlw(a));
+}
+
 /* -------------------------------- zeros ------------------------------ */
 
 static PyObject *
@@ -89,9 +101,9 @@
 /* ------------------------------- count_n ----------------------------- */
 
 /* Return the smallest index i for which a.count(vi, 0, i) == n.
-   When n exceeds the total count, the result is a always negative
-   number (the negative of the total count + 1, which is useful
-   for displaying the error message). */
+   When n exceeds the total count, the result is a negative
+   number; the negative of the total count + 1, which is useful
+   for displaying the error message. */
 static Py_ssize_t
 count_n_core(bitarrayobject *a, Py_ssize_t n, int vi)
 {
@@ -102,8 +114,6 @@
     Py_ssize_t m;             /* popcount in each block */
 
     assert(0 <= n && n <= nbits);
-    if (n == 0)
-        return 0;
 
     /* by counting big blocks we save comparisons and updates */
 #define BLOCK_BITS  4096      /* block size: 4096 bits = 64 words */
@@ -129,12 +139,14 @@
     }
 
     while (i < nbits && t < n) {
-        t += getbit(a, i++) == vi;
+        t += getbit(a, i) == vi;
+        i++;
     }
 
-    if (t < n)  /* n exceeds total count */
+    if (t < n) {  /* n exceeds total count */
+        assert((vi ? t : nbits - t) == count_from_word(a, 0));
         return -(t + 1);
-
+    }
     return i;
 }
 
@@ -1028,22 +1040,6 @@
     return n;
 }
 
-/* Starting from word index `i`, count the remaining population in bitarray
-   buffer.  Equivalent to:  a[64 * i:].count()  */
-static Py_ssize_t
-count_from_word(bitarrayobject *a, Py_ssize_t i)
-{
-    const Py_ssize_t nbits = a->nbits;
-    Py_ssize_t cnt = 0;
-
-    if (64 * i >= nbits)
-        return 0;
-    cnt += popcnt_words(WBUFF(a) + i, nbits / 64 - i);
-    if (nbits % 64)
-        cnt += popcnt_64(zlw(a));
-    return cnt;
-}
-
 /* ---------------------- sparse compressed bitarray -------------------
  *
  * see also: doc/sparse_compression.rst
@@ -1063,7 +1059,7 @@
    is constructed around this. */
 #define SEGSIZE  32
 
-/* number of 256 bit segments given nbits */
+/* number of segments for given number of bits */
 #define NSEG(nbits)  (((nbits) + 8 * SEGSIZE - 1) / (8 * SEGSIZE))
 
 /* Calculate an array with the running totals (rts) for 256 bit segments.
@@ -1109,9 +1105,9 @@
 static Py_ssize_t *
 sc_calc_rts(bitarrayobject *a)
 {
-    const Py_ssize_t nbits = a->nbits;
-    const Py_ssize_t n_seg = NSEG(nbits);     /* number of segments */
-    const Py_ssize_t c_seg = nbits / (8 * SEGSIZE);  /* complete segments */
+    /* total number of segments - number of complete segments */
+    const Py_ssize_t n_seg = NSEG(a->nbits);
+    const Py_ssize_t c_seg = a->nbits / (8 * SEGSIZE);
     char zeros[SEGSIZE];                      /* segment with only zeros */
     Py_ssize_t cnt = 0;                       /* current count */
     char *buff;                               /* buffer in current segment */
@@ -1134,7 +1130,7 @@
     res[c_seg] = cnt;
 
     if (n_seg > c_seg) {           /* we have a final partial segment */
-        cnt += count_from_word(a, (SEGSIZE / 8) * c_seg);
+        cnt += count_from_word(a, c_seg * SEGSIZE / 8);
         res[n_seg] = cnt;
     }
     return res;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/bitarray/bitarray.h 
new/bitarray-2.7.6/bitarray/bitarray.h
--- old/bitarray-2.7.5/bitarray/bitarray.h      2023-06-10 21:56:55.000000000 
+0200
+++ new/bitarray-2.7.6/bitarray/bitarray.h      2023-06-24 23:18:21.000000000 
+0200
@@ -4,7 +4,7 @@
 
    Author: Ilan Schnell
 */
-#define BITARRAY_VERSION  "2.7.5"
+#define BITARRAY_VERSION  "2.7.6"
 
 #ifdef STDC_HEADERS
 #include <stddef.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/bitarray/test_bitarray.py 
new/bitarray-2.7.6/bitarray/test_bitarray.py
--- old/bitarray-2.7.5/bitarray/test_bitarray.py        2023-06-10 
21:56:55.000000000 +0200
+++ new/bitarray-2.7.6/bitarray/test_bitarray.py        2023-06-24 
23:18:21.000000000 +0200
@@ -103,7 +103,7 @@
             return randint(-length - 5, length + 5)
 
     @staticmethod
-    def other_endian(endian):
+    def opposite_endian(endian):
         t = {'little': 'big',
              'big': 'little'}
         return t[endian]
@@ -542,13 +542,13 @@
             self.assertFalse(a is b)
             self.assertEQUAL(a, b)
 
-            endian2 = self.other_endian(endian)
+            endian2 = self.opposite_endian(endian)
             b = bitarray(a, endian2)
             self.assertEqual(b.endian(), endian2)
             self.assertEqual(a, b)
 
         for a in self.randombitarrays():
-            endian2 = self.other_endian(a.endian())
+            endian2 = self.opposite_endian(a.endian())
             b = bitarray(a, endian2)
             self.assertEqual(a, b)
             self.assertEqual(b.endian(), endian2)
@@ -2816,7 +2816,7 @@
             a = urandom(8 * n, self.random_endian())
             b = a.copy()
             a.bytereverse()
-            a = bitarray(a, self.other_endian(a.endian()))
+            a = bitarray(a, self.opposite_endian(a.endian()))
             self.assertEqual(a.tobytes(), b.tobytes())
 
 tests.append(MethodTests)
@@ -4652,7 +4652,7 @@
         n = 0
         for a in self.randombitarrays():
             a = frozenbitarray(a)
-            b = frozenbitarray(a, self.other_endian(a.endian()))
+            b = frozenbitarray(a, self.opposite_endian(a.endian()))
             self.assertEqual(a, b)
             self.assertNotEqual(a.endian(), b.endian())
             self.assertEqual(hash(a), hash(b))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/bitarray/test_util.py 
new/bitarray-2.7.6/bitarray/test_util.py
--- old/bitarray-2.7.5/bitarray/test_util.py    2023-06-10 21:56:55.000000000 
+0200
+++ new/bitarray-2.7.6/bitarray/test_util.py    2023-06-24 23:18:21.000000000 
+0200
@@ -552,9 +552,10 @@
             tc = a.count(v)      # total count
             i = count_n(a, tc, v)
             self.check_result(a, tc, i, v)
+            n = tc + 1
             self.assertRaisesMessage(ValueError, "n = %d exceeds total count "
-                                     "(a.count(%d) = %d)" % (tc + 1, v, tc),
-                                     count_n, a, tc + 1, v)
+                                     "(a.count(%d) = %d)" % (n, v, tc),
+                                     count_n, a, n, v)
             for _ in range(20):
                 n = randint(0, tc)
                 i = count_n(a, n, v)
@@ -566,6 +567,8 @@
                 n = a.count(v) // 2
                 i = count_n(a, n, v)
                 self.check_result(a, n, i, v)
+                # n = 0 -> count_n always 0
+                self.assertEqual(count_n(a, 0, v), 0)
 
 tests.append(TestsCount_N)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/doc/changelog.rst 
new/bitarray-2.7.6/doc/changelog.rst
--- old/bitarray-2.7.5/doc/changelog.rst        2023-06-10 21:56:55.000000000 
+0200
+++ new/bitarray-2.7.6/doc/changelog.rst        2023-06-24 23:18:21.000000000 
+0200
@@ -1,6 +1,11 @@
 Change log
 ==========
 
+**2.7.6** (2023-06-24):
+
+* remove caching hash value, fixes issue `#201 
<https://github.com/ilanschnell/bitarray/issues/201>`__
+
+
 **2.7.5** (2023-06-10):
 
 * fix for pypy3.9-v7.3.11, `#198 
<https://github.com/ilanschnell/bitarray/issues/198>`__ (fixes `#188 
<https://github.com/ilanschnell/bitarray/issues/188>`__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitarray-2.7.5/doc/reference.rst 
new/bitarray-2.7.6/doc/reference.rst
--- old/bitarray-2.7.5/doc/reference.rst        2023-06-10 21:56:55.000000000 
+0200
+++ new/bitarray-2.7.6/doc/reference.rst        2023-06-24 23:18:21.000000000 
+0200
@@ -1,7 +1,7 @@
 Reference
 =========
 
-bitarray version: 2.7.5 -- `change log 
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
+bitarray version: 2.7.6 -- `change log 
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
 
 In the following, ``item`` and ``value`` are usually a single bit -
 an integer 0 or 1.

Reply via email to