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

[Patch] Fix position of apr_initialize() in Python bindings

From: Max Bowsher <maxb_at_ukf.net>
Date: 2005-09-30 19:22:31 CEST

Move apr initialization into the C code that runs as a result of "import
libsvn._core", which should be imported as a result of importing any other
module.

I'd commit this, but I'm about to go out for a few hours, so I'll just post
it here for now.

Index: subversion/bindings/swig/core.i
===================================================================
--- subversion/bindings/swig/core.i (revision 16377)
+++ subversion/bindings/swig/core.i (working copy)
@@ -635,6 +635,8 @@
 PyObject *svn_swig_py_register_cleanup(PyObject *py_pool, apr_pool_t
*pool);

 %init %{
+apr_initialize();
+
 /* This is a hack. I dunno if we can count on SWIG calling the module "m"
*/
 PyModule_AddObject(m, "SubversionException",
                    svn_swig_py_register_exception());
Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
===================================================================
--- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (revision
16377)
+++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (working
copy)
@@ -72,14 +72,6 @@
   PyThreadState *thread_state;

   if (_saved_thread_key == NULL) {
-
- /* This is ugly. We call svn_swig_py_release_py_lock before executing
any
- subversion function. Thus it gets called before any call to
- apr_initialize in our script. This means we have to call
- apr_initialize ourselves, or otherwise we won't be able to
- create our pool. */
- apr_initialize();
-
     /* Obviously, creating a top-level pool for this is pretty stupid. */
     apr_pool_create(&_saved_thread_pool, NULL);
     apr_threadkey_private_create(&_saved_thread_key, NULL,
_saved_thread_pool);
Index: subversion/bindings/swig/proxy/proxy_apr.swg
===================================================================
--- subversion/bindings/swig/proxy/proxy_apr.swg (revision 16377)
+++ subversion/bindings/swig/proxy/proxy_apr.swg (working copy)
@@ -61,7 +61,6 @@
         # then initialize APR and set this pool
         # to be the application-level pool
         if not self._parent_pool:
- apr_initialize()
           svn_swig_py_set_application_pool(self, self)
           application_pool = self

Index: subversion/bindings/swig/core.i
===================================================================
--- subversion/bindings/swig/core.i (revision 16377)
+++ subversion/bindings/swig/core.i (working copy)
@@ -635,6 +635,8 @@
 PyObject *svn_swig_py_register_cleanup(PyObject *py_pool, apr_pool_t
*pool);

 %init %{
+apr_initialize();
+
 /* This is a hack. I dunno if we can count on SWIG calling the module "m"
*/
 PyModule_AddObject(m, "SubversionException",
                    svn_swig_py_register_exception());
Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
===================================================================
--- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (revision
16377)
+++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (working
copy)
@@ -72,14 +72,6 @@
   PyThreadState *thread_state;

   if (_saved_thread_key == NULL) {
-
- /* This is ugly. We call svn_swig_py_release_py_lock before executing
any
- subversion function. Thus it gets called before any call to
- apr_initialize in our script. This means we have to call
- apr_initialize ourselves, or otherwise we won't be able to
- create our pool. */
- apr_initialize();
-
     /* Obviously, creating a top-level pool for this is pretty stupid. */
     apr_pool_create(&_saved_thread_pool, NULL);
     apr_threadkey_private_create(&_saved_thread_key, NULL,
_saved_thread_pool);
Index: subversion/bindings/swig/proxy/proxy_apr.swg
===================================================================
--- subversion/bindings/swig/proxy/proxy_apr.swg (revision 16377)
+++ subversion/bindings/swig/proxy/proxy_apr.swg (working copy)
@@ -61,7 +61,6 @@
         # then initialize APR and set this pool
         # to be the application-level pool
         if not self._parent_pool:
- apr_initialize()
           svn_swig_py_set_application_pool(self, self)
           application_pool = self

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 30 19:23:26 2005

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.