[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-commits
Subject:    svn commit: r1871861 - in /subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py:
From:       futatuki () apache ! org
Date:       2019-12-20 14:24:42
Message-ID: 20191220142442.D0E8417A010 () svn01-us-east ! apache ! org
[Download RAW message or body]

Author: futatuki
Date: Fri Dec 20 14:24:42 2019
New Revision: 1871861

URL: http://svn.apache.org/viewvc?rev=1871861&view=rev
Log:
Fix implementation of svn_client_status_func_t function for swig-py 

* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
 (svn_swig_py_client_status_func): Fix type from void to svn_error_t *.
* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
 (svn_swig_py_client_status_func): Fix type from void to svn_error_t *.
 - Remove the code to save/restore Python Error context.
 - Remove the code to clear C API error status
 - Return error status as it is

Reported by: stsp

Modified:
    subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
    subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h

Modified: subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
                
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c?rev=1871861&r1=1871860&r2=1871861&view=diff
 ==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c \
                (original)
+++ subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c Fri \
Dec 20 14:24:42 2019 @@ -3041,10 +3041,10 @@ void svn_swig_py_status_func(void *baton
   svn_swig_py_release_py_lock();
 }
 
-void svn_swig_py_client_status_func(void *baton,
-                                    const char *path,
-                                    const svn_client_status_t *status,
-                                    apr_pool_t *scratch_pool)
+svn_error_t *svn_swig_py_client_status_func(void *baton,
+                                            const char *path,
+                                            const svn_client_status_t *status,
+                                            apr_pool_t *scratch_pool)
 {
   PyObject *function = baton;
   PyObject *result;
@@ -3052,15 +3052,10 @@ void svn_swig_py_client_status_func(void
   PyObject *exc, *exc_type, *exc_traceback;
 
   if (function == NULL || function == Py_None)
-    return;
+    return err;
 
   svn_swig_py_acquire_py_lock();
 
-  /* As caller can't understand Python context and we can't notify if
-     Python call back function raise exception to caller, we must catch it
-     if it is occurred, and restore error indicator */
-  PyErr_Fetch(&exc_type, &exc, &exc_traceback);
-
   if (status == NULL)
     {
       result = PyObject_CallFunction(function,
@@ -3096,13 +3091,8 @@ void svn_swig_py_client_status_func(void
       Py_DECREF(result);
     }
 
-  /* Our error has no place to go. :-( */
-  svn_error_clear(err);
-
-  /* Also, restore error indicator */
-  PyErr_Restore(exc_type, exc, exc_traceback);
-
   svn_swig_py_release_py_lock();
+  return err;
 }
 
 

Modified: subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
                
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h?rev=1871861&r1=1871860&r2=1871861&view=diff
 ==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h \
                (original)
+++ subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h Fri \
Dec 20 14:24:42 2019 @@ -315,10 +315,10 @@ void svn_swig_py_status_func(void *baton
 
 /* a client status function that executes a Python function that is passed in
    via the baton argument */
-void svn_swig_py_client_status_func(void *baton,
-                                    const char *path,
-                                    const svn_client_status_t *status,
-                                    apr_pool_t *scratch_pool);
+svn_error_t *svn_swig_py_client_status_func(void *baton,
+                                            const char *path,
+                                            const svn_client_status_t *status,
+                                            apr_pool_t *scratch_pool);
 
 /* a svn_delta_path_driver callback that executes a Python function
   that is passed in via the baton argument */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic