git: fdad3e1b5329 - main - devel/py-subversion{,-lts}: swig-py: Fix `none_dealloc` error (one-off patch)

From: Michael Osipov <michaelo_at_FreeBSD.org>
Date: Sat, 28 Sep 2024 08:43:54 UTC
The branch main has been updated by michaelo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fdad3e1b5329ce582c89c6bb71d0d83272622bc1

commit fdad3e1b5329ce582c89c6bb71d0d83272622bc1
Author:     Michael Osipov <michaelo@FreeBSD.org>
AuthorDate: 2024-09-27 08:17:33 +0000
Commit:     Michael Osipov <michaelo@FreeBSD.org>
CommitDate: 2024-09-28 08:43:28 +0000

    devel/py-subversion{,-lts}: swig-py: Fix `none_dealloc` error (one-off patch)
    
    PR:             281709
    Approved by:    jrm (mentor), otis (mentor)
    Differential Revision:  https://reviews.freebsd.org/D46807
---
 devel/py-subversion/Makefile                       |  4 +-
 .../patch-eae531008b3454d2709b8aaf766b08e37160668a | 44 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/devel/py-subversion/Makefile b/devel/py-subversion/Makefile
index 40fabe32d855..85b5d681eb35 100644
--- a/devel/py-subversion/Makefile
+++ b/devel/py-subversion/Makefile
@@ -12,8 +12,8 @@ USE_PYTHON=	flavors py3kplist
 # There is bug in python bindings Makefile
 MAKE_JOBS_UNSAFE=yes
 
-PORTREVISION_LATEST=	4
-PORTREVISION_LTS=		2
+PORTREVISION_LATEST=	5
+PORTREVISION_LTS=		3
 
 SVN_BUILD_BINDINGS=	yes
 
diff --git a/devel/py-subversion/files/patch-eae531008b3454d2709b8aaf766b08e37160668a b/devel/py-subversion/files/patch-eae531008b3454d2709b8aaf766b08e37160668a
new file mode 100644
index 000000000000..e14e6545cb3b
--- /dev/null
+++ b/devel/py-subversion/files/patch-eae531008b3454d2709b8aaf766b08e37160668a
@@ -0,0 +1,44 @@
+--- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c.orig	2023-10-20 04:00:04 UTC
++++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
+@@ -2321,8 +2321,6 @@ static svn_error_t *apply_textdelta(void *file_baton,
+      in Python.  */
+   if (result == Py_None)
+     {
+-      Py_DECREF(result);
+-
+       *handler = svn_delta_noop_window_handler;
+       *h_baton = NULL;
+     }
+@@ -2839,8 +2837,7 @@ parse_fn3_apply_textdelta(svn_txdelta_window_handler_t
+ {
+   PyObject *editor = NULL, *baton_item = NULL, *py_pool = NULL;
+   PyObject *ib = node_baton;
+-  apr_pool_t *pool;
+-  PyObject *result;
++  PyObject *result = NULL;
+   svn_error_t *err;
+ 
+   svn_swig_py_acquire_py_lock();
+@@ -2863,13 +2860,12 @@ parse_fn3_apply_textdelta(svn_txdelta_window_handler_t
+      in Python.  */
+   if (result == Py_None)
+     {
+-      Py_DECREF(result);
+-
+       *handler = svn_delta_noop_window_handler;
+       *handler_baton = NULL;
+     }
+   else
+     {
++      apr_pool_t *pool;
+       /* return the thunk for invoking the handler. the baton creates
+          new reference of our 'result' reference, which is the handler,
+          so we release it even if no error. */
+@@ -2890,6 +2886,7 @@ parse_fn3_apply_textdelta(svn_txdelta_window_handler_t
+   err = SVN_NO_ERROR;
+ 
+  finished:
++  Py_XDECREF(result);
+   svn_swig_py_release_py_lock();
+   return err;
+ }