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

Re: SEGFAULTs with Python bindings and generators

From: C. Michael Pilato <cmpilato_at_red-bean.com>
Date: Tue, 29 Sep 2020 19:51:28 -0400

Thanks for the reply. And I see what you're trying to do there, but in
practice it doesn't seem to work. The swig proxy object doesn't allow
arbitrary attribute creation:

AttributeError: You cannot add instance attributes to <libsvn.fs.svn_fs_t;
> proxy of <Swig Object of type 'svn_fs_t *' at 0x7f83bd4be420> >

I tried to work around this using this construct:

- fs.repos = repos
> + fs.__dict__['repos'] = repos

...and that avoids the AttributeError, but alas the code still SEGFAULTs.
I'm attaching a(n edited for readability) log from a gdb session.

-- Mike

On Tue, Sep 29, 2020 at 4:01 PM Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
wrote:

> On 2020/09/29 22:35, C. Michael Pilato wrote:
> > Sorry for the self-reply, but I thought I'd note that if I tweak
> > pysvnget thusly, the SEGFAULTs stop:
> >
> > --- pysvnget 2020-09-29 09:34:07.918002584 -0400
> >> +++ pysvnget.pools 2020-09-29 09:33:54.278153037 -0400
> >> @@ -21,17 +21,17 @@
> >> yield chunk
> >> svn.core.svn_stream_close(self.stream)
> >>
> >> -def get_generator(repos_path, peg_revision, path):
> >> - fs = svn.repos.fs(svn.repos.open(repos_path))
> >> +def get_generator(repos_path, peg_revision, path, pool):
> >> + fs = svn.repos.fs(svn.repos.open(repos_path, pool))
>
> The pool used by fs comes from temporary svn_repos_t *repos object.
> However, svn.repos.fs wrapper function doesn't have a special
> treatment about it in current implementation, so it is nothing
> to do with the pool.
>
> If you don't want to use a pool explicitly, you need to keep the
> svn_repos_t wrapper object created by svn.repos.open() while
> fs object exists, like this.
>
> [[[
> --- pysvnget.orig 2020-09-29 22:00:40.000000000 +0900
> +++ pysvnget 2020-09-30 04:41:33.419721000 +0900
> @@ -22,7 +22,9 @@
> svn.core.svn_stream_close(self.stream)
>
> def get_generator(repos_path, peg_revision, path):
> - fs = svn.repos.fs(svn.repos.open(repos_path))
> + repos = svn.repos.open(repos_path)
> + fs = svn.repos.fs(repos)
> + fs.repos = repos
> peg_revision = peg_revision or svn.fs.youngest_rev(fs)
> fsroot = svn.fs.revision_root(fs, peg_revision)
> return SvnContentProxy(fsroot, path).get_generator()
> ]]]
>
> Cheers,
> --
> Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>
>

Received on 2020-09-30 01:52:07 CEST

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.