public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-bidict] rawhide: Backport patch for Python 3.15 test regression
@ 2026-08-25 15:10 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-08-25 15:10 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-bidict
Branch : rawhide
Commit : 72601652a14f030dc0528c0d756818a3b1d985b4
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-08-25T16:09:12+01:00
Stats  : +65/-5 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-bidict/c/72601652a14f030dc0528c0d756818a3b1d985b4?branch=rawhide

Log:
Backport patch for Python 3.15 test regression

---
diff --git a/bidict-0.24.0-python-3.15.patch b/bidict-0.24.0-python-3.15.patch
new file mode 100644
index 0000000..ea7a8ee
--- /dev/null
+++ b/bidict-0.24.0-python-3.15.patch
@@ -0,0 +1,52 @@
+From 36f3481b598d71f8a8abb2414c9eafbf76f81cb9 Mon Sep 17 00:00:00 2001
+From: Joshua Bronson <jabronson@gmail.com>
+Date: Tue, 25 Aug 2026 10:39:12 -0400
+Subject: [PATCH] Keep the refusing-dict fixture counting popitem on Python
+ 3.15
+
+bidict_refusing_nth_write() builds a backing mapping that refuses its nth
+write, by counting the writes that pass through __setitem__ and __delitem__.
+That relied on UserDict routing every removal through __delitem__, which held
+until Python 3.15 gave UserDict a popitem() of its own that goes straight to
+self.data. On 3.15, MutableBidict.popitem()'s read of _fwdm.popitem() then
+escaped the count, so only one of a removal's two writes could be refused and
+test_remove_fails_clean_when_a_backing_mapping_refuses[popitem-bidict] failed.
+
+This patch has the fixture take MutableMapping's popitem(), which removes via
+__delitem__ on every supported Python, so the count spans both backing
+mappings again. bidict itself needed no change: only the fixture assumed how
+UserDict removes.
+
+Closes: #407
+
+Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
+---
+ tests/bidict_test_fixtures.py | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/tests/bidict_test_fixtures.py b/tests/bidict_test_fixtures.py
+index 3a847f73..61323cef 100644
+--- a/tests/bidict_test_fixtures.py
++++ b/tests/bidict_test_fixtures.py
+@@ -14,6 +14,7 @@
+ from collections.abc import Iterable
+ from collections.abc import KeysView
+ from collections.abc import Mapping
++from collections.abc import MutableMapping
+ from collections.abc import Reversible
+ from dataclasses import dataclass
+ from itertools import chain
+@@ -363,6 +364,13 @@ def __delitem__(self, key: t.Any) -> None:
+             tick()
+             super().__delitem__(key)
+ 
++        @override
++        def popitem(self) -> tuple[t.Any, t.Any]:
++            # Python 3.15 gave UserDict a popitem() of its own that goes straight to self.data,
++            # bypassing __delitem__ and so escaping the count above. Take MutableMapping's
++            # implementation, which removes via __delitem__ on every supported Python.
++            return MutableMapping.popitem(self)
++
+     bi_t_refusing = type(f'Refusing{bi_t.__name__}', (bi_t,), {'_fwdm_cls': RefusingDict, '_invm_cls': RefusingDict})
+     bi = bi_t_refusing(init)
+     counting = True  # writing init above must not count

diff --git a/python-bidict.spec b/python-bidict.spec
index 5045fa6..b95ca78 100644
--- a/python-bidict.spec
+++ b/python-bidict.spec
@@ -8,6 +8,19 @@ URL:            https://bidict.readthedocs.io
 %global forgeurl https://github.com/jab/bidict
 Source:         %{forgeurl}/archive/v%{version}/bidict-%{version}.tar.gz
 
+
+# Keep the refusing-dict fixture counting popitem on Python 3.15
+# https://github.com/jab/bidict/commit/36f3481b598d71f8a8abb2414c9eafbf76f81cb9
+#
+# Fixes:
+#
+# Python 3.15.0rc1:
+# test_remove_fails_clean_when_a_backing_mapping_refuses[popitem-bidict] fails
+# https://github.com/jab/bidict/issues/407
+#
+# Without changelog modifications.
+Patch:          bidict-0.24.0-python-3.15.patch
+
 BuildSystem:    pyproject
 BuildOption(generate_buildrequires): --dependency-groups test
 BuildOption(install): --assert-license bidict
@@ -49,11 +62,6 @@ Summary:        %{summary}
 # is otherwise not needed in Fedora at all.
 ignore="${ignore-} --ignore=docs/extending.rst"
 
-# Python 3.15.0rc1:
-# test_remove_fails_clean_when_a_backing_mapping_refuses[popitem-bidict] fails
-# https://github.com/jab/bidict/issues/407
-k="${k-}${k+ and }not test_remove_fails_clean_when_a_backing_mapping_refuses[popitem-bidict]"
-
 %pytest ${ignore-} -k "${k-}"
 
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-25 15:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-25 15:10 [rpms/python-bidict] rawhide: Backport patch for Python 3.15 test regression Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox