[Twisted-Python] Re: [Twisted-commits] InMemoryUsernamePasswordDatabaseDontUse didn't raise the error properly when the password was wrong

Glyph Lefkowitz glyph at twistedmatrix.com
Sun Sep 28 20:04:45 EDT 2003


Itamar Shtull-Trauring wrote:
> On Sun, 28 Sep 2003 17:44:47 -0600
> teratorn CVS <teratorn at wolfwood.twistedmatrix.com> wrote:
> 
> 
>>-            return failure.Failure(error.UnauthorizedLogin())
>>+            raise error.UnauthorizedLogin()
>> 
> 
> 
> Uh. Why does one work and not the other? That looks like a bug in
> Deferred to me. Aren't returned Failures supposed to be the same as
> raised exceptions in callbacks?
> 

Considering that the two are equivalent, the former style is preferred 
in situations like this, since it does not create Python traceback info 
(which is _noticeably_ slower than not doing it).





More information about the Twisted-Python mailing list