[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python bindings API confusion

From: Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
Date: Sat, 26 Dec 2020 20:02:58 +0900

On 2020/12/26 3:38, Nathan Hartman wrote:

> But the solution you suggest above, adding a new_rev attribute to the
> exception and leaving the return value as it was, sounds like a good way to
> avoid the incompatibility and also avoid the API bump.

I had written such a patch on typemaps at first because it was straight
forward. Although I removed it after r1880967 is commited, I can write
such a code again and I'll do if it is needed.

Alternately, here is an easier way to do it. The patch below is a code
that replace wrapper function entity on top of the svn.fs module
(not tested, and more appropriate comment is needed in the code).

[[[
Index: subversion/bindings/swig/python/svn/fs.py
===================================================================
--- subversion/bindings/swig/python/svn/fs.py (revision 1884802)
+++ subversion/bindings/swig/python/svn/fs.py (working copy)
@@ -24,6 +24,14 @@
 ######################################################################
 
 from libsvn.fs import *
+
+# For API compatibility we should replace wrapper function entity before
+# adding alternative names.
+_svn_fs_commit_txn = svn_fs_commit_txn
+def svn_fs_commit_txn(*args) -> "char const **, svn_revnum_t *":
+ r"""svn_fs_commit_txn(svn_fs_txn_t txn, apr_pool_t pool) -> svn_error_t"""
+ return None, _svn_fs_commit_txn(*args)
+
 from svn.core import _unprefix_names, Pool, _as_list
 _unprefix_names(locals(), 'svn_fs_')
 _unprefix_names(locals(), 'SVN_FS_')

]]]

Of course, we can use svn_fs_commit_txn2 instead of _svn_fs_commit_txn
in above patch, then it will satisfy the Daniel's proposal.

Cheers,

-- 
Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>
Received on 2020-12-26 12:08:14 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.