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

RE: Re: Bug: log-police.py and python 3.0rc1

From: Luke Imhoff <luke_at_cray.com>
Date: Thu, 02 Oct 2008 09:30:41 -0500

It won't work. It's a syntax check. The syntax is still checked even
if it's in an if that's not used. You could probably do the
sys.Version_info[:2] < (2, 3) and then import * from a file with the
sets in only if it's true. That way the file will only be loaded on
those systems. This won't work if all the files are precompiled in a
package though as the < 2.3 file will still be parsed for syntax errors
then.

On Thu, 2008-10-02 at 07:21 -0700, Gleason, Todd wrote:
> Can't you just check sys.version_info and only set True/False if
> sys.Version_info[:2] < (2, 3) ?
>
> > -----Original Message-----
> > From: news [mailto:news_at_ger.gmane.org] On Behalf Of Dave Lawrence
> > Sent: Thursday, October 02, 2008 6:48 AM
> > To: users_at_subversion.tigris.org
> > Cc: SubVersion Users
> > Subject: Re: Bug: log-police.py and python 3.0rc1
> >
> > Ryan Schmidt wrote:
> > > With python 3.0rc1, the log-police.py script says this:
> > >
> > >
> > > File
> "/opt/local/share/subversion/tools/hook-scripts/log-police.py",
> > > line 24
> > > True = 1
> > > SyntaxError: assignment to keyword
> > >
> > >
> > > It works fine with python 2.5.2.
> >
> > Infact in python 2.5 you can say True = 0 !
> >
> > This code is trying to maintain compatability with python pre 2.3
> which
> > didn't have True and False. There must be loads of code out there
> that
> > does this, it will all be broken because the syntax check happens
> > regardless of whether the except clause is actually invoked.
> >
> > Maybe the Python guys can offer a solution to what surely is about to
> > become a common problem.
> >
> > If not, I offer two: either:
> > 1) Define our own true and false (as True and False if available or as
> 0
> > and 1 if not). log-police.patch attached
> >
> > or
> > 2) Don't try and assign to True and False at all, this will break
> > compatibility with python pre 2.3. log-police2.patch attached.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-02 16:32:04 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.