You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ryan Schmidt <su...@ryandesign.com> on 2008/10/01 21:04:47 UTC

Bug: log-police.py and python 3.0rc1

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.


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

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

Posted by Luke Imhoff <lu...@cray.com>.
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@ger.gmane.org] On Behalf Of Dave Lawrence
> > Sent: Thursday, October 02, 2008 6:48 AM
> > To: users@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@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 


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

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

Posted by "Gleason, Todd" <tg...@impac.com>.
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@ger.gmane.org] On Behalf Of Dave Lawrence
> Sent: Thursday, October 02, 2008 6:48 AM
> To: users@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@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


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

Posted by Pa...@Dell.com.
>From: Dave Lawrence [mailto:dlawrence@ad-holdings.co.uk] 
>
>Paul_Koning@Dell.com wrote:
>> Slip of the fingers -- I meant:
>>  
>> 	exec("True=1")
>   
>Yes that works - if the exec is executed conditionally.  Under python 3
>the execpt clause won't be executed so this works.  Patch attached.
>(sanity check - when was "exec" introduced?)

It's in 2.2 judging by the fact that my "Python in a Nutshell" book, which describes V2.2, has it without any disclaimers about futures.  I don't know how much older, I'm a relative newcomer to Python.

	paul

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

Posted by Dave Lawrence <dl...@ad-holdings.co.uk>.
Paul_Koning@Dell.com wrote:
> Slip of the fingers -- I meant:
>  
> 	exec("True=1")
>
>   
Yes that works - if the exec is executed conditionally.  Under python 3
the execpt clause won't be executed so this works.  Patch attached.
(sanity check - when was "exec" introduced?)

PS has the list done something to change the "reply all" behaviour?


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

Posted by Pa...@Dell.com.
Slip of the fingers -- I meant:
 
	exec("True=1")

(lose the single quote.)

	paul

> 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.

Try using 'exec("True=1").

	paul


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

Posted by Pa...@Dell.com.
> 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.

Try using 'exec("True=1").

	paul


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

Posted by Dave Lawrence <dl...@ad-holdings.co.uk>.
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.


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

Posted by Dave Lawrence <dl...@ad-holdings.co.uk>.
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.