Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-immutables for
openSUSE:Factory checked in at 2021-08-06 22:44:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-immutables (Old)
and /work/SRC/openSUSE:Factory/.python-immutables.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-immutables"
Fri Aug 6 22:44:24 2021 rev:7 rq:910245 version:0.15
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-immutables/python-immutables.changes
2021-04-26 16:39:01.082017731 +0200
+++
/work/SRC/openSUSE:Factory/.python-immutables.new.1899/python-immutables.changes
2021-08-06 22:44:37.730086779 +0200
@@ -1,0 +2,8 @@
+Thu Aug 5 06:23:30 UTC 2021 - Matej Cepl <[email protected]>
+
+- Upstream fixed problems with 32bit systems
+ (gh#MagicStack/immutables#69) so we have removed
+ skip_32bit_tests.patch and added new solution which actually fixes the
+ issue: test_none_collisions-32-bit.patch.
+
+-------------------------------------------------------------------
Old:
----
skip_32bit_tests.patch
New:
----
test_none_collisions-32-bit.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-immutables.spec ++++++
--- /var/tmp/diff_new_pack.O9ijbg/_old 2021-08-06 22:44:39.498083642 +0200
+++ /var/tmp/diff_new_pack.O9ijbg/_new 2021-08-06 22:44:39.502083635 +0200
@@ -25,9 +25,9 @@
License: Apache-2.0
URL: https://github.com/MagicStack/immutables
Source:
https://files.pythonhosted.org/packages/source/i/immutables/immutables-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM skip_32bit_tests.patch gh#MagicStack/immutables#53
[email protected]
-# skip failing tests on 32bit architectures
-Patch0: skip_32bit_tests.patch
+# PATCH-FIX-UPSTREAM test_none_collisions-32-bit.patch
gh#MagicStack/immutables#69 [email protected]
+# Fix test_none_collisions on 32-bit systems
+Patch0: test_none_collisions-32-bit.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
++++++ test_none_collisions-32-bit.patch ++++++
>From a52107d45023a29fe24b97efe849915429e9bb96 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <[email protected]>
Date: Tue, 3 Aug 2021 18:04:22 -0700
Subject: [PATCH] Fix test_none_collisions on 32-bit systems
There are two issues at play here:
1. Python version of `map_hash` unnecessarily performs hash truncation
even if the hash is already 32-bit wide, which potentially converts
it from signed int to unsigned long.
2. The `test_none_collisions` test generates a collision node with
hash greater than 2^32.
Both of these are problematic on 32-bit systems, where `sizeof(Py_hash_t)`
is 4, and so anything that doesn't fit into `Py_hash_t` gets bit-mangled,
breaking the `hash(x) != x` invariance that the test relies upon.
Fixes: #53
Fixes: #50
---
immutables/map.py | 5 ++++-
tests/test_none_keys.py | 14 +++++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)
--- a/immutables/map.py
+++ b/immutables/map.py
@@ -19,7 +19,10 @@ _mut_id = itertools.count(1).__next__
def map_hash(o):
x = hash(o)
- return (x & 0xffffffff) ^ ((x >> 32) & 0xffffffff)
+ if sys.hash_info.width > 32:
+ return (x & 0xffffffff) ^ ((x >> 32) & 0xffffffff)
+ else:
+ return x
def map_mask(hash, shift):
--- a/tests/test_none_keys.py
+++ b/tests/test_none_keys.py
@@ -1,3 +1,4 @@
+import ctypes
import unittest
from immutables.map import map_hash, map_mask, Map as PyMap
@@ -6,16 +7,19 @@ from immutables._testutils import HashKe
none_hash = map_hash(None)
assert(none_hash != 1)
-assert((none_hash >> 32) == 0)
+assert(none_hash.bit_length() <= 32)
-not_collision = 0xffffffff & (~none_hash)
+none_hash_u = ctypes.c_size_t(none_hash).value
+not_collision = 0xffffffff & (~none_hash_u)
mask = 0x7ffffffff
-none_collisions = [none_hash & (mask >> shift)
+none_collisions = [none_hash_u & (mask >> shift)
for shift in reversed(range(0, 32, 5))]
assert(len(none_collisions) == 7)
-none_collisions = [h | (not_collision & (mask << shift))
- for shift, h in zip(range(5, 37, 5), none_collisions)]
+none_collisions = [
+ ctypes.c_ssize_t(h | (not_collision & (mask << shift))).value
+ for shift, h in zip(range(5, 37, 5), none_collisions)
+]
class NoneCollision(HashKey):