trow in subversion

OK, now I understand a bit more about how python's threads work. It

turns out that the python thread API puts the burden on us to do some

of their bookkeeping and track some data on a per-thread basis.

Luckily, apr provides a wrapper around pthread_{set,get}specific so

that we can do this in a portable way.

* swigutil_py.c

(release_py_lock) Store the PyThreadState in the thread's private

address space.

(acquire_py_lock) When re-acquiring the interpreter lock, get the

PyThreadState from the thread's private address space.

Added code to make the swig bindings release python's global

interpreter lock before calling the subversion function being bound,

and to re-acquire the lock after the call is complete. This allows us

to perform slow operations in a python thread without blocking

the execution of other python code.

* subversion/bindings/swig/svn_types.i:

Added an %exception block to release/acquire the interpreter lock

around our function calls.

* subversion/bindings/swig/swigutil_py.c:

(release_py_lock): Added. Releases the python interpreter lock and

saves the thread state.

(acquire_py_lock): Added. Reacquires the interpreter lock and

restores the thread state.

(close_baton): Reacquire the lock before trying to evaluate any python

code, the release the lock before returning.

(thunk_set_target_revision): Ditto.

(thunk_open_root): Ditto.

(thunk_delete_entry): Ditto.

(thunk_add_directory): Ditto.

(thunk_open_directory): Ditto.

(thunk_change_dir_prop): Ditto.

(thunk_add_file): Ditto.

(thunk_open_file): Ditto.

(thunk_window_handler): Ditto.

(thunk_apply_textdelta): Ditto.

(thunk_change_file_prop): Ditto.

(svn_swig_py_notify_func): Ditto.

(svn_swig_py_get_commit_log_func): Ditto.

(svn_swig_py_thunk_log_receiver): Ditto.

    • -33
    • +161

These are a few small changes to fix the bindings for svn_client_ls.

* util.i

Commented out an "%ignore svn_dirent" directive, since we need those

wrappers to be generated.

* svn_client.i

Added a typemap to deal with the apr_hash_t of svn_dirent_t's returned

by svn_client_ls.

    • -1
    • +4

Greg Stein has (very wisely) suggested that the bindings for svn_opt.h

should be inside of the _util extension. This gets rid of the

_opt namespace that I created in revision 3395 and lets SWIG do more

of the work.

* subversion/bindings/swig/svn_opt.i


* subversion/bindings/swig/svn_client.i

Remove the %import of svn_opt.i

* subversion/bindings/swig/python/

Removed the code to build the opt stuff.

* subversion/bindings/swig/swigutils_py.h

* subversion/bindings/swig/swigutils_py.c

Removed my misbegotten python -> svn_opt_revision_t marshaller.

* subversion/bindings/swig/util.i

Included svn_opt.h.

    • -1
    • +6

A small fix.

* subversion/bindings/swig/python/

Our _util module needs to link against the svn_swig_py-1 library.

This is another chunk of work towards getting the python bindings into shape.

My goal is to just get things more-or-less working --- there is some ugly,

graceless stuff in here that should be cleaned up later.

* subversion/bindings/swig/apr.i

Added a typemap for apr_file_t *.

* subversion/bindings/swig/svn_string.i

Added a cast to the const apr_array_header_t * typemap tTo suppress

a compiler warning.

* subversion/bindings/swig/svn_client.i

%import svn_opt.i and don't %ignore svn_client_commit, svn_client_log

and svn_client_diff.

* subversion/bindings/swig/svn_opt.i

Added. SWIGification of svn_opt.h, which we particularly need for

the definition of svn_opt_revision_t.

* subversion/bindings/swig/python/

Added the proper incantation to make sure that svn_opt.i gets processed.

* subversion/bindings/swig/swigutil_py.h

* subversion/bindings/swig/swigutil_py.c

Added more glue code for the python bindings.

(svn_swig_py_make_file): Converts a PyObject * to an apr_file_t.

(svn_swig_py_make_opt_revision): Converts a PyObject * to an

svn_opt_revision_t *.

    • -0
    • +32

A few bindings-related changes.


Modified the 'install-swig-py-ext' rule to install into the correct


* subversion/bindings/swig/swigutils_py.h

* subversion/bindings/swig/swigutils_py.c

(svn_swig_py_notify_func): Added. This is a notify callback that

"thunks" the arguments into a python function call.

* subversion/bindings/swig/svn_client.i

Added swig magic for handling svn_wc_notify_func_t/baton pairs.

This fixes a few small bugs in the Client library bindings.

* bindings/swig/svn_client.i:

- Fixed a crash in the 'out' %typemap that converts an apr_array_header_t

into a python list.

- Added %typemaps for const char *xml_src and const char *xml_dst that

explicitly allow these arguments to be 'None' in python.