[Top][All Lists]

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

[PATCH 2/2] fix typos

From: Chris Brannon
Subject: [PATCH 2/2] fix typos
Date: Thu, 12 Aug 2010 22:58:18 -0500

> 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')
# ---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

reply via email to

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