Files
subversion/subversion-1.14.4-swig-4.3.0-swig-py.patch

128 lines
4.6 KiB
Diff

------------------------------------------------------------------------
r1921523 | jun66j5 | 2024-10-24 05:11:00 +0200 (Thu, 24 Oct 2024) | 3 lines
Changed paths:
M /subversion/branches/1.14.x-r1921505
M /subversion/branches/1.14.x-r1921505/subversion/bindings/swig/include/svn_types.swg
M /subversion/branches/1.14.x-r1921505/subversion/bindings/swig/python/tests/client.py
M /subversion/branches/1.14.x-r1921505/subversion/bindings/swig/python/tests/core.py
On the 1.14.x-r1921505 branch: Merge r1921505 from trunk without changes for
`%typemap() svn_error_t * SVN_ERR_WITH_ATTRS`.
------------------------------------------------------------------------
Index: 1.14.x-r1921505/subversion/bindings/swig/include/svn_types.swg
===================================================================
--- 1.14.x-r1921505/subversion/bindings/swig/include/svn_types.swg (revision 1921522)
+++ 1.14.x-r1921505/subversion/bindings/swig/include/svn_types.swg (revision 1921523)
@@ -435,9 +435,32 @@
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
#ifdef SWIGPERL
Index: 1.14.x-r1921505/subversion/bindings/swig/python/tests/client.py
===================================================================
--- 1.14.x-r1921505/subversion/bindings/swig/python/tests/client.py (revision 1921522)
+++ 1.14.x-r1921505/subversion/bindings/swig/python/tests/client.py (revision 1921523)
@@ -172,7 +172,9 @@
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 @@
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)
Index: 1.14.x-r1921505/subversion/bindings/swig/python/tests/core.py
===================================================================
--- 1.14.x-r1921505/subversion/bindings/swig/python/tests/core.py (revision 1921522)
+++ 1.14.x-r1921505/subversion/bindings/swig/python/tests/core.py (revision 1921523)
@@ -333,7 +333,35 @@
[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(
SubversionCoreTestCase)
Index: 1.14.x-r1921505
===================================================================
--- 1.14.x-r1921505 (revision 1921522)
+++ 1.14.x-r1921505 (revision 1921523)
Property changes on: 1.14.x-r1921505
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
Merged /subversion/trunk:r1921505