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

Re: [PATCH] swig-py: restrict *-import to svn_* names

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sun, 18 Mar 2012 13:52:11 +0200

Роман Донченко wrote on Sun, Mar 18, 2012 at 15:36:24 +0400:
> Daniel Shahaf <danielsh_at_elego.de> писал в своём письме Sun, 18 Mar
> 2012 04:07:45 +0400:
>
> >[[[
> >Index: subversion/bindings/swig/python/svn/fs.py
> >===================================================================
> >--- subversion/bindings/swig/python/svn/fs.py (revision 1301511)
> >+++ subversion/bindings/swig/python/svn/fs.py (working copy)
> >@@ -27,6 +27,7 @@ from libsvn.fs import *
> > from svn.core import _unprefix_names, Pool
> > _unprefix_names(locals(), 'svn_fs_')
> > _unprefix_names(locals(), 'SVN_FS_')
> >+__all__ = filter(lambda x: x.lower().startswith('svn_'),
> >locals().keys())
> > del _unprefix_names
> >]]]
> >
> >Before:
> > % python -c 'from svn.fs import *;
> > print [x for x in locals().keys() if "begin_txn2" in x]'
> > ['svn_fs_begin_txn2', 'begin_txn2']
> >
> >After:
> > % python -c 'from svn.fs import *;
> > print [x for x in locals().keys() if "begin_txn2" in x]'
> > ['svn_fs_begin_txn2']
> >
>
> This would nullify the purpose of _unprefix_names, would it not?
>

No. It enables this code:

  from svn.fs import *
  svn_fs_begin_txn2()

but doesn't break the "old way":

  import svn.fs
  svn.fs.begin_txn2()

> Roman.
>
Received on 2012-03-18 12:52:55 CET

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.