speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] fix typos


From: Trevor Saunders
Subject: [PATCH 2/2] fix typos
Date: Fri, 13 Aug 2010 00:08:01 -0400

Hi,

 ok, I think i understand, would you mind doing the patch?  i can't stand 
python for some reason :-)

Trev

On Thu, Aug 12, 2010 at 10:58:18PM -0500, Chris Brannon wrote:
> > I thought we decided the only way it could fail was if the function it 
> > calls 
> > raised an exception itself?
> 
> Ok, maybe I misunderstood.  You're right.
> _send_command raises SSIPCommandError when it gets a response code other
> than 2xx, and it raises IOError when the connection is closed prematurely.
> Those two should cover most of the errors for set_data_mode.
> 
> I also noticed that set_data_mode will throw an UnboundLocalError when
> assertions are disabled and the mode parameter is not one of the
> DataMode constants.
> E.G., try running the following program using
> python -O program.py
> Note: -O disables assertions.
> 
> # ---begin---
> from speechd.client import SSIPClient
> 
> s = SSIPClient('foo')
> s.set_data_mode('no_such_mode')
> s.close()
> # ---end---
> 
> That probably needs to be fixed,
> because UnboundLocalError isn't too helpful.  It's a side-effect of the
> way in which the method was written.
> I'd be inclined to remove the assert in set_data_mode, replacing
> the if ... elif tests with if ... elif ... else, where the else branch
> throws ValueError.
> 
> -- Chris
> 
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd



reply via email to

[Prev in Thread] Current Thread [Next in Thread]