Author: svn-role
Date: Tue Nov 19 04:00:19 2024
New Revision: 1921949
URL: http://svn.apache.org/viewvc?rev=1921949&view=rev
Log:
Merge the 1.14.x-r1921505 branch:
* r1921505
Make swig-py compatible with SWIG 4.3.0.
Justification:
Ditto.
Branch: 1.14.x-r1921505
Votes:
+1: jun66j5, astieger
Modified:
subversion/branches/1.14.x/ (props changed)
subversion/branches/1.14.x/STATUS
subversion/branches/1.14.x/subversion/bindings/swig/include/svn_types.swg
subversion/branches/1.14.x/subversion/bindings/swig/python/tests/client.py
subversion/branches/1.14.x/subversion/bindings/swig/python/tests/core.py
Propchange: subversion/branches/1.14.x/
------------------------------------------------------------------------------
Merged /subversion/branches/1.14.x-r1921505:r1921522-1921948
Merged /subversion/trunk:r1921505
Modified: subversion/branches/1.14.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/STATUS?rev=1921949&r1=1921948&r2=1921949&view=diff
==============================================================================
--- subversion/branches/1.14.x/STATUS (original)
+++ subversion/branches/1.14.x/STATUS Tue Nov 19 04:00:19 2024
@@ -50,14 +50,6 @@ Veto-blocked changes:
Approved changes:
=================
- * r1921505
- Make swig-py compatible with SWIG 4.3.0.
- Justification:
- Ditto.
- Branch: 1.14.x-r1921505
- Votes:
- +1: jun66j5, astieger
-
* r1921371
Add regression tests for CVE-2024-45720.
Justification:
Modified:
subversion/branches/1.14.x/subversion/bindings/swig/include/svn_types.swg
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/include/svn_types.swg?rev=1921949&r1=1921948&r2=1921949&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/include/svn_types.swg
(original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/include/svn_types.swg
Tue Nov 19 04:00:19 2024
@@ -435,8 +435,31 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
svn_error_clear($1);
SWIG_fail;
}
- Py_INCREF(Py_None);
- $result = Py_None;
+ Py_XDECREF($result);
+ $result = PyList_New(0);
+}
+
+%typemap(ret) svn_error_t * {
+ if ($result == NULL) {
+ $result = Py_None;
+ Py_INCREF($result);
+ }
+ else {
+ switch (PyList_Size($result)) {
+ case 0:
+ $result = Py_None;
+ Py_INCREF($result);
+ break;
+ case 1:
+ {
+ PyObject *tmp = $result;
+ $result = PyList_GetItem(tmp, 0);
+ Py_INCREF($result);
+ Py_DECREF(tmp);
+ }
+ break;
+ }
+ }
}
#endif
Modified:
subversion/branches/1.14.x/subversion/bindings/swig/python/tests/client.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/python/tests/client.py?rev=1921949&r1=1921948&r2=1921949&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/python/tests/client.py
(original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/python/tests/client.py
Tue Nov 19 04:00:19 2024
@@ -172,7 +172,9 @@ class SubversionClientTestCase(unittest.
path = self.temper.alloc_empty_dir('-checkout')
- self.assertRaises(ValueError, client.checkout2,
+ # TypeError is raised since SWIG 4.3.0
+ self.assertRaises((ValueError, TypeError), r'Received a NULL pointer',
+ client.checkout2,
self.repos_uri, path, None, None, True, True,
self.client_ctx)
@@ -526,7 +528,9 @@ class SubversionClientTestCase(unittest.
path = self.temper.alloc_empty_dir('-update')
- self.assertRaises(ValueError, client.checkout2,
+ # TypeError is raised since SWIG 4.3.0
+ self.assertRaises((ValueError, TypeError), r'Received a NULL pointer',
+ client.checkout2,
self.repos_uri, path, None, None, True, True,
self.client_ctx)
Modified:
subversion/branches/1.14.x/subversion/bindings/swig/python/tests/core.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/bindings/swig/python/tests/core.py?rev=1921949&r1=1921948&r2=1921949&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/bindings/swig/python/tests/core.py
(original)
+++ subversion/branches/1.14.x/subversion/bindings/swig/python/tests/core.py
Tue Nov 19 04:00:19 2024
@@ -333,6 +333,34 @@ class SubversionCoreTestCase(unittest.Te
[b'', 1])
svn.core.svn_stream_close(stream)
+ def test_svn_rangelist_diff(self):
+ """
+ SWIG incorrectly handles return values when the first %append_output() is
+ invoked with a list instance. svn.core.svn_rangelist_diff() is in the case.
+ We test whether the workaround for it is working.
+ """
+
+ def from_args(start, end, inheritable):
+ instance = svn.core.svn_merge_range_t()
+ instance.start = start
+ instance.end = end
+ instance.inheritable = inheritable
+ return instance
+
+ def to_args(instance):
+ return [instance.start, instance.end, instance.inheritable]
+
+ def map_list(f, iterator):
+ return list(map(f, iterator))
+
+ from_ = [from_args(4, 5, True), from_args(9, 13, True)]
+ to = [from_args(7, 11, True)]
+ rv = svn.core.svn_rangelist_diff(from_, to, True)
+ self.assertIsInstance(rv, (list, tuple))
+ deleted, added = rv
+ self.assertEqual([[7, 9, True]], map_list(to_args, added))
+ self.assertEqual([[4, 5, True], [11, 13, True]],map_list(to_args, deleted))
+
def suite():
return unittest.defaultTestLoader.loadTestsFromTestCase(