[issue9136] RuntimeError when profiling Decimal

Alexander Belopolsky report at bugs.python.org
Mon Jul 5 03:36:08 CEST 2010

Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

+        try:
+            dc = DefaultContext
+        except NameError:
+            pass
+        self.prec = dc.prec if prec is None else prec

I don't quite understand the point of catching NameError here, but it looks like if it is caught, it will just be raised by the next line because dc will not be set.

Also, I am not sure ternary expressions are a big readability win here, but if you want to keep them, consider 

self.prec = prec if prec is not None else dc.prec

nosy: +belopolsky

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list