possible NoneType error

Bug #1498680 reported by Christopher Trudeau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Concurrent Log Handler for Python
New
Undecided
Unassigned

Bug Description

I've used ConcurrentLogHandler as a basis for a handler I've written (thanks, way easier than starting from scratch). In the process of going through unittests I was able to trigger a situation where the stream is not locked and the check for the closed attribute causes a NoneType error. It is a one line fix:

    def close(self):
        """
        Close log stream and stream_lock. """
        try:
            self._close()
            if hasattr(self.stream_lock, 'closed') and \
                    not self.stream_lock.closed:
                self.stream_lock.close()
        finally:
            self.stream_lock = None
            Handler.close(self)

Just add the "hasattr". I don't think it was something I modified that caused the problem to arise so I figured I'd pass along the fix just in case. If it was my stupidity that triggered the situation feel free to ignore the ticket :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.