Bug 2359500

Summary: subversion fails to build with Python 3.14: AssertionError: 3 != 4 : Memory leak! Expected a ref count of 4 for svn_merge_range_t object, but got 3 instead (path: b'/trunk', index: 0)
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: subversionAssignee: Tomas Korbar <tkorbar>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jorton, ksurma, mhroncok, rlescak, tkorbar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2025-04-14 13:22:15 UTC
subversion fails to build with Python 3.14.0a7.

+ make check-swig-py
mkdir /builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python/libsvn
if [ "LD_LIBRARY_PATH" = "DYLD_LIBRARY_PATH" ]; then for d in /builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python/libsvn_swig_py /builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python/../../../libsvn_*; do if [ -n "$DYLD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$d/.libs"; else LD_LIBRARY_PATH="$d/.libs"; fi; done; export LD_LIBRARY_PATH; fi; \
cd /builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python; \
  /usr/bin/python3 /builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python/tests/run_all.py
..................F.........................s........................................................................F...........................................
======================================================================
FAIL: test_mergeinfo_leakage__incorrect_range_t_refcounts (mergeinfo.SubversionMergeinfoTestCase.test_mergeinfo_leakage__incorrect_range_t_refcounts)
Ensure that the ref counts on svn_merge_range_t objects returned by
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python/tests/mergeinfo.py", line 147, in test_mergeinfo_leakage__incorrect_range_t_refcounts
    self.assertEqual(refcount, expected, (
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
      "Memory leak!  Expected a ref count of %d for svn_merge_range_t "
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      "object, but got %d instead (path: %s, index: %d).  Probable "
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      "cause: incorrect Py_INCREF/Py_DECREF usage in libsvn_swig_py/"
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      "swigutil_py.c." % (expected, refcount, path, i)))
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 3 != 4 : Memory leak!  Expected a ref count of 4 for svn_merge_range_t object, but got 3 instead (path: b'/trunk', index: 0).  Probable cause: incorrect Py_INCREF/Py_DECREF usage in libsvn_swig_py/swigutil_py.c.

======================================================================
FAIL: test_replay_batons_refcounts (repository.SubversionRepositoryTestCase.test_replay_batons_refcounts)
Issue SVN-4917: check ref-count of batons created and used in callbacks
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/subversion-1.14.5-build/subversion-1.14.5/subversion/bindings/swig/python/tests/repository.py", line 438, in test_replay_batons_refcounts
    self.assertEqual(sys.getrefcount(e_ptr), 2,
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     "leak on editor baton after replay without errors")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1 != 2 : leak on editor baton after replay without errors

----------------------------------------------------------------------
Ran 161 tests in 3.317s

FAILED (failures=2, skipped=1)

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08899613-subversion/

For all our attempts to build subversion with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/subversion/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro HronĨok 2025-05-14 17:11:53 UTC
Possibly related to https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-refcount

"""
The interpreter internally avoids some reference count modifications when loading objects onto the operands stack by borrowing references when possible. This can lead to smaller reference count values compared to previous Python versions.
"""