On Fri, Jul 25, 2025 at 12:37:56AM +0900, Yasuhito FUTATSUKI wrote:
> Thank you for testing.
> 
> The intention of those tests are detection of extra reference
> remaining after calling callback functions. However, with deferred
> reference counting and biased reference counting, it cannot work
> as I(we?) expected.  So I don't think the changes on r1926575 is
> correct if no one cannot explain why this part of the test could
> pass without modifying expected refcount.
> 
> I propose:
> 
> * Use weakref for the tests of this purpose
> * Until those test is rewrited with using weakref, simply skip
>   them on Python >= 3.14.

Thanks for looking at this, that seems reasonable to me. The attached 
reverts r1926575 and adds skipIf decorators, does it look correct? I'll 
run it through a build too.

Regards, Joe
Index: subversion/bindings/swig/python/tests/mergeinfo.py
===================================================================
--- subversion/bindings/swig/python/tests/mergeinfo.py  (revision 1927462)
+++ subversion/bindings/swig/python/tests/mergeinfo.py  (working copy)
@@ -125,6 +125,8 @@
       }
     self.compare_mergeinfo_catalogs(mergeinfo, expected_mergeinfo)
 
+  @unittest.skipIf(sys.version_info >= (3, 14),
+                   "Reference counting tests skipped for Python 3.14+")
   def test_mergeinfo_leakage__incorrect_range_t_refcounts(self):
     """Ensure that the ref counts on svn_merge_range_t objects returned by
        svn_mergeinfo_parse() are correct."""
@@ -139,7 +141,7 @@
 
         refcount = sys.getrefcount(r)
         # ....and finally, 4 (getrefcount() also increfs, but not as of 3.14)
-        expected = 3 if sys.version_info >= (3, 14) else 4
+        expected = 4
 
         # Note: if path and index are not '/trunk' and 0 respectively, then
         # only some of the range objects are leaking, which is, as far as
Index: subversion/bindings/swig/python/tests/repository.py
===================================================================
--- subversion/bindings/swig/python/tests/repository.py (revision 1927462)
+++ subversion/bindings/swig/python/tests/repository.py (working copy)
@@ -424,12 +424,13 @@
     del subpool
     self.assertEqual(None, editor_ref())
 
+  @unittest.skipIf(sys.version_info >= (3, 14),
+                   "Reference counting tests skipped for Python 3.14+")
   def test_replay_batons_refcounts(self):
     """Issue SVN-4917: check ref-count of batons created and used in 
callbacks"""
     root = fs.revision_root(self.fs, self.rev)
     editor = BatonCollector(self.fs, root)
     e_ptr, e_baton = delta.make_editor(editor)
-    expected = 1 if sys.version_info >= (3, 14) else 2
     repos.replay(root, e_ptr, e_baton)
     for baton in editor.batons:
       self.assertEqual(sys.getrefcount(baton[2]), 2,
@@ -436,7 +437,7 @@
                        "leak on baton %s after replay without errors"
                        % repr(baton))
     del e_baton
-    self.assertEqual(sys.getrefcount(e_ptr), expected,
+    self.assertEqual(sys.getrefcount(e_ptr), 2,
                      "leak on editor baton after replay without errors")
 
     editor = BatonCollectorErrorOnClose(self.fs, root,
@@ -452,7 +453,7 @@
       self.assertEqual(sys.getrefcount(baton[2]), 2,
                        "leak on baton %s after replay with an error"
                        % repr(baton))
-    self.assertEqual(sys.getrefcount(e_ptr), expected,
+    self.assertEqual(sys.getrefcount(e_ptr), 2,
                      "leak on editor baton after replay with an error")
 
   def test_delta_editor_apply_textdelta_handler_refcount(self):

Reply via email to