From bce6dd430203496456c429e38be40c813539e525 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 26 Aug 2013 00:22:22 +0200 Subject: [PATCH] StdoutCapture: Browse weakref only if they actually are weakrefs. --- StdoutCapture/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/StdoutCapture/plugin.py b/StdoutCapture/plugin.py index 329702b..9151654 100644 --- a/StdoutCapture/plugin.py +++ b/StdoutCapture/plugin.py @@ -31,6 +31,7 @@ import sys import json import logging +import weakref import supybot.utils as utils from supybot.commands import * @@ -68,9 +69,8 @@ class StdoutCapture(callbacks.Plugin): sys.stderr = self.StdoutBuffer(sys.stderr) # I'm being a bit evil here. for logger in logging._handlerList: - if isinstance(logger, StdoutBuffer): - continue - logger = logger() # That's a weakref + if isinstance(logger, weakref.ref): + logger = logger() if not hasattr(logger, 'stream'): continue if logger.stream is sys.stdout._real: