Opened 15 years ago

Last modified 15 years ago

#1103 defect closed fixed (fixed)

TypeError in Failure.raiseException when using defer.deferredGenerator and perspective broker

Reported by: titty Owned by:
Priority: high Milestone:
Component: Keywords:
Cc: titty Branch:


Change History (4)

comment:1 Changed 15 years ago by titty

The following program shows the bug.
Failure.raiseException doesn't handle the case where the exception is a string.

last lines of output:

[Failure instance: Traceback: exceptions.TypeError: exceptions must be classes,
instances, or strings (deprecated), not type
--- <exception caught here> ---

#! /usr/bin/env python

from twisted.spread import pb
from twisted.internet import reactor, defer
class Echoer(pb.Root):
    def remote_echo(self, st):
        raise NotImplementedError('no')

def doit():
    wait = defer.waitForDeferred
    factory = pb.PBClientFactory()
    reactor.connectTCP("", 8789, factory)
    d = wait(factory.getRootObject())
    yield d
    d = d.getResult()
    d=wait(d.callRemote("echo", "foobar"))
    yield d
    d = d.getResult()
if __name__ == '__main__':
    reactor.listenTCP(8789, pb.PBServerFactory(Echoer()))

    def done(r):
        print r

    doit().addCallbacks(done, done)

comment:2 Changed 15 years ago by titty

this bug happens with latest svn version (r14095)

comment:3 Changed 15 years ago by titty

guess this is fixed with r14234

r627 (orig r14234):  radix | 2005-08-03 07:04:14 +0200
Changed paths:
  M  /mirror/Twisted-trunk/twisted/python/
  M  /mirror/Twisted-trunk/twisted/test/

don't allow raiseException to totally barf when the failure is wrapping a string
use self.type instead of self.value.__class__. teratorn tracked this down.

comment:4 Changed 10 years ago by <automation>

Note: See TracTickets for help on using tickets.