imported method from module evaluates to None in some cases

Andrew andrewpadilla1 at gmail.com
Thu Nov 20 08:35:33 EST 2008


Hi:

I'm having a problem in some zope (2.10) code (HTTPResponse.py) where
a method that gets imported somehow evaluates to None in certain cases
which causes a TypeError exception to be raised (eg: TypeError:
'NoneType' object is not callable). The code excerpt is below where
the exception is raised on the line with the comment 'TypeError IS
RAISED HERE'. I've read that the thread stack size may be insufficient
but the I compiled a test pthreads program on the same system to get
the default. I used pthread_attr_getstacksize() and it returned
3657952 (3.5 mb?). I would imagine that's enough. Any ideas how this
could occur?

from PubCore.ZEvent import Wakeup

def close(self):
        DebugLogger.log('A', id(self._request),
                '%s %s' % (self._request.reply_code, self._bytes))
        if not self._channel.closed:
            self._channel.push(LoggingProducer(self._request,
self._bytes), 0)
            self._channel.push(CallbackProducer(self._channel.done),
0)
            self._channel.push(CallbackProducer(
                lambda t=('E', id(self._request)): apply
(DebugLogger.log, t)), 0)
            if self._shutdown:
                self._channel.push(ShutdownProducer(), 0)
                Wakeup()
            else:
                if self._close: self._channel.push(None, 0)
            Wakeup()    # TypeError IS RAISED HERE
        else:
            # channel closed too soon

            self._request.log(self._bytes)
            DebugLogger.log('E', id(self._request))

            if self._shutdown:
                Wakeup(lambda: asyncore.close_all())
            else:
                Wakeup()

        self._channel=None #need to break cycles?
        self._request=None





More information about the Python-list mailing list