You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David James <ja...@gmail.com> on 2005/08/02 16:06:16 UTC

Call for testing on the "python-bindings-improvements" branch

Anyone noticed the "python-bindings-improvements" branch yet?

We need your help!
1) Please take a look at the branch and let me know whether "make
check-swig-py" runs on your machine.
2) Please look at the code changes and send me your feedback. Any and
all comments are much appreciated!

For a list of changes, see:
  http://svn.haxx.se/dev/archive-2005-08/0004.shtml
To download the branch, checkout from the following repository:
  http://svn.collab.net/repos/svn/branches/python-bindings-improvements/
Instructions for building and compiling the branch can be found at:
http://svn.collab.net/repos/svn/branches/python-bindings-improvements/subversion/bindings/swig/INSTALL

Thanks!

David

-- 
David James -- http://www.cs.toronto.edu/~james

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Python properties destroyed when container Pool is garbage collected

Posted by "troy d. straszheim" <tr...@resophonic.com>.
Cool.  That fixes it here too.  The "real python strings" make debugging 
easier, as well.  Thanks.

-t

David James wrote:
> On 8/4/05, troy d. straszheim <tr...@resophonic.com> wrote:
> 
>>Here's a new version:  on my machine, at the end, it shows that things
>>are garbled...   rhmmm.  I'm going to try this on a linux box as well.
>>
>>-t
>>
>>#!/usr/bin/env python
>>
>>import sys
>>import os
>>import getopt
>>import pprint
>>
>>
>>from svn import fs, core, repos
>>
>>os.system("rm -rf /tmp/temp_repo temp_checkout")
>>os.system("svnadmin create /tmp/temp_repo")
>>os.system("svn co file:///tmp/temp_repo ./temp_checkout")
>>os.chdir("./temp_checkout")
>>os.system("svn propset svn:externals \"short /external\" .")
>>os.system("svn commit -m first_rev_has_external")
>>os.system("svn propset svn:externals \"this_one /is_really_really_really_long_and_comes_out_completely_garbled\" .")
>>os.system("svn commit -m next_rev_has_empty_external")
>>
>>repos_ptr = repos.open("/tmp/temp_repo", core.Pool())
>>fsob = repos.fs(repos_ptr)
>>
>>young_root = fs.revision_root(fsob, 2, core.Pool())
>>old_root = fs.revision_root(fsob, 1, core.Pool())
>>
>>young_props = fs.node_proplist(young_root, "/", core.Pool())
>>old_props = fs.node_proplist(old_root, "/", core.Pool())
>>
>>oldprop = old_props["svn:externals"]
>>assert(young_props.has_key("svn:externals"))
>>youngprop = young_props["svn:externals"]
>>if old_props["svn:externals"] != young_props["svn:externals"]:
>>  print "gah."
>>print len(young_props["svn:externals"])
>>
>>print "this external should be garbled: >>>%(external)s<<<" % { 'external' : youngprop }
> 
> 
> Wow! Thanks for the detailed test case, Troy! I've fixed this by
> turning SVN strings into real python strings, instead of pointers to
> "pool memory".
> 
> Fixed in r15595.
> 
> Cheers,
> 
> David
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python properties destroyed when container Pool is garbage collected

Posted by David James <ja...@gmail.com>.
On 8/4/05, troy d. straszheim <tr...@resophonic.com> wrote:
> Here's a new version:  on my machine, at the end, it shows that things
> are garbled...   rhmmm.  I'm going to try this on a linux box as well.
> 
> -t
> 
> #!/usr/bin/env python
> 
> import sys
> import os
> import getopt
> import pprint
> 
> #os.putenv("PYTHONPATH", "/Users/troy/Projects/svn-install/lib/svn-python")
> #os.putenv("DYLD_LIBRARY_PATH", "/Users/troy/Projects/svn-install/lib")
> 
> from svn import fs, core, repos
> 
> os.system("rm -rf /tmp/temp_repo temp_checkout")
> os.system("svnadmin create /tmp/temp_repo")
> os.system("svn co file:///tmp/temp_repo ./temp_checkout")
> os.chdir("./temp_checkout")
> os.system("svn propset svn:externals \"short /external\" .")
> os.system("svn commit -m first_rev_has_external")
> os.system("svn propset svn:externals \"this_one /is_really_really_really_long_and_comes_out_completely_garbled\" .")
> os.system("svn commit -m next_rev_has_empty_external")
> 
> repos_ptr = repos.open("/tmp/temp_repo", core.Pool())
> fsob = repos.fs(repos_ptr)
> 
> young_root = fs.revision_root(fsob, 2, core.Pool())
> old_root = fs.revision_root(fsob, 1, core.Pool())
> 
> young_props = fs.node_proplist(young_root, "/", core.Pool())
> old_props = fs.node_proplist(old_root, "/", core.Pool())
> 
> oldprop = old_props["svn:externals"]
> assert(young_props.has_key("svn:externals"))
> youngprop = young_props["svn:externals"]
> if old_props["svn:externals"] != young_props["svn:externals"]:
>   print "gah."
> print len(young_props["svn:externals"])
> 
> print "this external should be garbled: >>>%(external)s<<<" % { 'external' : youngprop }

Wow! Thanks for the detailed test case, Troy! I've fixed this by
turning SVN strings into real python strings, instead of pointers to
"pool memory".

Fixed in r15595.

Cheers,

David


-- 
David James -- http://www.cs.toronto.edu/~james

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Call for testing on the "python-bindings-improvements" branch

Posted by David James <ja...@gmail.com>.
On 8/3/05, troy d. straszheim <tr...@resophonic.com> wrote:
> Cool.  This stuff works for me on OSX 10.4, gcc4, python 2.4.1.
> svnlook.py works, the two tests pass.

Fantastic! I don't have access to an OS X box, so your feedback is
especially valuable.

Cheers,

David

-- 
David James -- http://www.cs.toronto.edu/~james

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Call for testing on the "python-bindings-improvements" branch

Posted by "troy d. straszheim" <tr...@resophonic.com>.
Cool.  This stuff works for me on OSX 10.4, gcc4, python 2.4.1. 
svnlook.py works, the two tests pass.

-t

David James wrote:
> Anyone noticed the "python-bindings-improvements" branch yet?
> 
> We need your help!
> 1) Please take a look at the branch and let me know whether "make
> check-swig-py" runs on your machine.
> 2) Please look at the code changes and send me your feedback. Any and
> all comments are much appreciated!
> 
> For a list of changes, see:
>   http://svn.haxx.se/dev/archive-2005-08/0004.shtml
> To download the branch, checkout from the following repository:
>   http://svn.collab.net/repos/svn/branches/python-bindings-improvements/
> Instructions for building and compiling the branch can be found at:
> http://svn.collab.net/repos/svn/branches/python-bindings-improvements/subversion/bindings/swig/INSTALL
> 
> Thanks!
> 
> David
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Call for testing on the "python-bindings-improvements" branch

Posted by Christopher Ness <ch...@nesser.org>.
On Wed, 2005-08-03 at 11:02 -0400, David James wrote:
> On 8/2/05, Christopher Ness <ch...@nesser.org> wrote:
> > Ok, here is my configure info and some version info:
> Chris, thanks a lot for sending me this information! It is very helpful!
> 
> I've committed fixes in r15565 and r15566. More details below.

No problem.
I updated to r15566 and recompiled/tested.

Things ran just fine.  The tests passed.

<snip>
> > /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:431: Warning(451): Setting const char * member may leak memory.
> > /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:432: Warning(451): Setting const char * member may leak memory.
> > /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:433: Warning(451): Setting const char * member may leak memory.
> > /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:434: Warning(451): Setting const char * member may leak memory.
> > /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_string.h:85: Warning(451): Setting const char * member may leak memory.
> 
> These warnings signal potential memory leaks, because SWIG and Python
> don't keep track of the memory during Python->C variable assignments.
> This bug is present on trunk as well. We haven't come up with a good
> solution to this yet. Ideas?

I don't know as my experience with python is minimal and SWIG is
non-existent.  But if SWIG and Python don't keep track of the memory,
than there is only one thing left to do it, right?

Cheers,
Chris
-- 
Wireless Group
McMaster University

summer
11:38:26 up 12 days, 21:31, 1 user, load average: 0.04, 0.05, 0.07



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Call for testing on the "python-bindings-improvements" branch

Posted by David James <ja...@gmail.com>.
On 8/2/05, Christopher Ness <ch...@nesser.org> wrote:
> Ok, here is my configure info and some version info:
Chris, thanks a lot for sending me this information! It is very helpful!

I've committed fixes in r15565 and r15566. More details below.

> [...]
> [nesscg@jackd python-bindings-improvements]$ python
> Python 2.2.3 (#1, Oct 15 2003, 23:33:35)
> [GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
> [...]
> checking swig version... 1.3.24
> [...]
> [nesscg@jackd python-bindings-improvements]$ svnversion .
> 15551
>
> make check-swig-py 2>&1
> cd /home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python; \
>   /usr/bin/python2 /home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python/tests/run_all.py
> EE
> ======================================================================
> ERROR: test_compatibility_layer (pool.PoolTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "/home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python/tests/pool.py", line 53, in test_compatibility_layer
>     self.assertTrue(pool_ref())
> AttributeError: PoolTestCase instance has no attribute 'assertTrue'
> 
> ======================================================================
> ERROR: test_pool (pool.PoolTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "/home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python/tests/pool.py", line 23, in test_pool
>     self.assertTrue(parent_pool_ref())
> AttributeError: PoolTestCase instance has no attribute 'assertTrue'
> 
> ----------------------------------------------------------------------
> Ran 2 tests in 0.013s
> 
> FAILED (errors=2)
> make: *** [check-swig-py] Error 1

Good catch! I've used functionality which is only available in newer
versions of Python. I've fixed this for Python 2.2 in r15565.

> 
> > 2) Please look at the code changes and send me your feedback. Any and
> > all comments are much appreciated!
> 
> These were brought up by the compiler for `make swig-py`.
Thanks for the report! I'll try to fix as many of the warnings as I
can. See below.

/home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c:
In function `svn_swig_py_pool_destroyed':
> /home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c:144: warning: passing arg 2 of `PyObject_SetAttrString' discards qualifiers from pointer target type
Good catch. I forgot to properly typecast a pointer. Fixed in r15566.


> /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:431: Warning(451): Setting const char * member may leak memory.
> /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:432: Warning(451): Setting const char * member may leak memory.
> /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:433: Warning(451): Setting const char * member may leak memory.
> /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_types.h:434: Warning(451): Setting const char * member may leak memory.
> /home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_string.h:85: Warning(451): Setting const char * member may leak memory.

These warnings signal potential memory leaks, because SWIG and Python
don't keep track of the memory during Python->C variable assignments.
This bug is present on trunk as well. We haven't come up with a good
solution to this yet. Ideas?

The other warnings look relatively harmless.

>/home/nesscg/sandbox/python-bindings-improvements/subversion/include/svn_props.h:305:
Warning(305): Bad constant value (ignored).

This is caused by SWIG having trouble with a Subversion header file.
It still works, though.

/home/nesscg/sandbox/python-bindings-improvements/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c:43:
> /usr/local/share/swig/1.3.24/python/pyrun.swg: In function
> `PySwigObject_GetType':
> /usr/local/share/swig/1.3.24/python/pyrun.swg:179: warning:
> initialization discards qualifiers from pointer target type
> /usr/local/share/swig/1.3.24/python/pyrun.swg: In function
> `PySwigPacked_GetType':
> /usr/local/share/swig/1.3.24/python/pyrun.swg:331: warning:
> initialization discards qualifiers from pointer target type
This looks like a harmless warning in the internals of SWIG 1.3.24 --
it doesn't show up in SWIG 1.3.25.

Cheers,

David

-- 
David James -- http://www.cs.toronto.edu/~james

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org