You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@subversion.apache.org by "Thomas Quinot (JIRA)" <ji...@apache.org> on 2017/03/12 19:37:04 UTC

[jira] [Updated] (SVN-4675) bad SWIG Python binding for functions taking multiple pool arguments

     [ https://issues.apache.org/jira/browse/SVN-4675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Quinot updated SVN-4675:
-------------------------------
          Description: 
Running the following script:
----------
import svn.core
def do_stuff(pool):
    s=svn.core.svn_stream_open_writable("/tmp/somefile")
    print s
svn.core.run_app(do_stuff)
----------
will display:
Traceback (most recent call last):
  File "bug1.py", line 5, in <module>
    svn.core.run_app(do_stuff)
  File "/usr/lib/python2.7/dist-packages/svn/core.py", line 345, in run_app
    return func(application_pool, *args, **kw)
  File "bug1.py", line 4, in do_stuff
    print s
  File "/usr/lib/python2.7/dist-packages/libsvn/core.py", line 5589, in __getattr__
    self.assert_valid()
  File "/usr/lib/python2.7/dist-packages/libsvn/core.py", line 5585, in assert_valid
    assert self.__dict__["_is_valid"](), "Variable has already been deleted"
AssertionError: Variable has already been deleted

If "pool" is passed explicitly as the pool and scratch pool in the call to svn_stream_open_writable however, the expected output will be observed:
<libsvn.core.svn_stream_t; proxy of <Swig Object of type 'svn_stream_t *' at 0x7f0903e6eab0> >

I believe that this is the same bug originally discussed here:
    # https://svn.haxx.se/dev/archive-2014-10/0037.shtml

which is related to the use of global variables to handle optional pool arguments (unlike e.g. the Ruby binding, which pushes pool arguments on a stack, so that multiple such arguments are properly freed upon return).

I was able to reproduce this with 1.9.3. It looks to me like the mapping wasn't substantially changed since then so this probably impacts the latest trunk version as well.

  was:
Running the following script:
----------
import svn.core
def do_stuff(pool):
    s=svn.core.svn_stream_open_writable("/tmp/somefile")
    print s
svn.core.run_app(do_stuff)
----------
will display:
Traceback (most recent call last):
  File "bug1.py", line 5, in <module>
    svn.core.run_app(do_stuff)
  File "/usr/lib/python2.7/dist-packages/svn/core.py", line 345, in run_app
    return func(application_pool, *args, **kw)
  File "bug1.py", line 4, in do_stuff
    print s
  File "/usr/lib/python2.7/dist-packages/libsvn/core.py", line 5589, in __getattr__
    self.assert_valid()
  File "/usr/lib/python2.7/dist-packages/libsvn/core.py", line 5585, in assert_valid
    assert self.__dict__["_is_valid"](), "Variable has already been deleted"
AssertionError: Variable has already been deleted

If "pool" is passed explicitly as the pool and scratch pool in the call to svn_stream_open_writable however, the expected output will be observed:
<libsvn.core.svn_stream_t; proxy of <Swig Object of type 'svn_stream_t *' at 0x7f0903e6eab0> >

I believe that this is the same bug originally discussed here:
    # https://svn.haxx.se/dev/archive-2014-10/0037.shtml
which is related to the use of global variables to handle optional pool arguments.

    Affects Version/s: 1.9.3

> bad SWIG Python binding for functions taking multiple pool arguments
> --------------------------------------------------------------------
>
>                 Key: SVN-4675
>                 URL: https://issues.apache.org/jira/browse/SVN-4675
>             Project: Subversion
>          Issue Type: Bug
>          Components: bindings_swig_python
>    Affects Versions: 1.9.3
>         Environment: x86_64-linux
>            Reporter: Thomas Quinot
>
> Running the following script:
> ----------
> import svn.core
> def do_stuff(pool):
>     s=svn.core.svn_stream_open_writable("/tmp/somefile")
>     print s
> svn.core.run_app(do_stuff)
> ----------
> will display:
> Traceback (most recent call last):
>   File "bug1.py", line 5, in <module>
>     svn.core.run_app(do_stuff)
>   File "/usr/lib/python2.7/dist-packages/svn/core.py", line 345, in run_app
>     return func(application_pool, *args, **kw)
>   File "bug1.py", line 4, in do_stuff
>     print s
>   File "/usr/lib/python2.7/dist-packages/libsvn/core.py", line 5589, in __getattr__
>     self.assert_valid()
>   File "/usr/lib/python2.7/dist-packages/libsvn/core.py", line 5585, in assert_valid
>     assert self.__dict__["_is_valid"](), "Variable has already been deleted"
> AssertionError: Variable has already been deleted
> If "pool" is passed explicitly as the pool and scratch pool in the call to svn_stream_open_writable however, the expected output will be observed:
> <libsvn.core.svn_stream_t; proxy of <Swig Object of type 'svn_stream_t *' at 0x7f0903e6eab0> >
> I believe that this is the same bug originally discussed here:
>     # https://svn.haxx.se/dev/archive-2014-10/0037.shtml
> which is related to the use of global variables to handle optional pool arguments (unlike e.g. the Ruby binding, which pushes pool arguments on a stack, so that multiple such arguments are properly freed upon return).
> I was able to reproduce this with 1.9.3. It looks to me like the mapping wasn't substantially changed since then so this probably impacts the latest trunk version as well.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)