Fix tests so they pass in -R mode
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 844cee0..f3f9215 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -42,11 +42,13 @@
# Tests are built around these assumed context defaults.
# test_main() restores the original context.
-ORIGINAL_CONTEXT = getcontext().copy()
-DefaultContext.prec = 9
-DefaultContext.rounding = ROUND_HALF_EVEN
-DefaultContext.traps = dict.fromkeys(Signals, 0)
-setcontext(DefaultContext)
+def init():
+ global ORIGINAL_CONTEXT
+ ORIGINAL_CONTEXT = getcontext().copy()
+ DefaultContext.prec = 9
+ DefaultContext.rounding = ROUND_HALF_EVEN
+ DefaultContext.traps = dict.fromkeys(Signals, 0)
+ setcontext(DefaultContext)
TESTDATADIR = 'decimaltestdata'
if __name__ == '__main__':
@@ -1069,6 +1071,7 @@
is enabled in regrtest.py
"""
+ init()
global TEST_ALL
TEST_ALL = arith or is_resource_enabled('decimal')