summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--pysnmp/debug.py7
2 files changed, 4 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 36e9b6d..dc6e520 100644
--- a/CHANGES
+++ b/CHANGES
@@ -39,7 +39,7 @@ Revision 4.2.6rc0
reworked towards more robust and simple design with the execution observer
facility.
- MIB instrumentation example improved to cover table index building facility.
-- Handle the case of absent stderr stream at Debug printer.
+- Handle the case of null writer at Debug printer.
- Fix to decodeMessageVersion() to withstand broken SNMP messages.
- Fix to rfc1902.Bits type to make it accepting hex and binary initializers,
cope with missing bits identifieirs at prettyPrint().
diff --git a/pysnmp/debug.py b/pysnmp/debug.py
index d3f1f36..01bf8e0 100644
--- a/pysnmp/debug.py
+++ b/pysnmp/debug.py
@@ -35,10 +35,9 @@ class Debug:
defaultPrinter = sys.stderr.write
def __init__(self, *flags):
self._flags = flagNone
- if self.defaultPrinter:
- self._printer = self.defaultPrinter
- else:
- self._printer = lambda x: None # stderr may not be available
+ if not self.defaultPrinter:
+ raise error.PySnmpError('Null debug writer specified')
+ self._printer = self.defaultPrinter
self('running pysnmp version %s' % __version__)
for f in flags:
inverse = f and f[0] in ('!', '~')