summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal/_decimal.c
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-04-02 13:02:21 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-04-02 13:02:21 (GMT)
commit5100171d81508e607a1c9c1ffa384ab07632a84f (patch)
treea81fdb71dfb44d65fc4271969f3730ca77c46a75 /Modules/_decimal/_decimal.c
parent41e031004bd156ea579a35d8e1d74cafe8dac3e0 (diff)
downloadcpython-5100171d81508e607a1c9c1ffa384ab07632a84f.zip
cpython-5100171d81508e607a1c9c1ffa384ab07632a84f.tar.gz
cpython-5100171d81508e607a1c9c1ffa384ab07632a84f.tar.bz2
Clear the context flags if a context is initialized from the DefaultContext.
Diffstat (limited to 'Modules/_decimal/_decimal.c')
-rw-r--r--Modules/_decimal/_decimal.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index bb2df44..d5d1134 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -1494,6 +1494,10 @@ current_context(void)
}
*CTX(module_context) = *CTX(default_context_template);
+ CTX(module_context)->status = 0;
+ CTX(module_context)->newtrap = 0;
+ CtxCaps(module_context) = CtxCaps(default_context_template);
+
module_context_set = 1;
return module_context;
}
@@ -1533,6 +1537,7 @@ PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v)
if (v == NULL) {
return NULL;
}
+ CTX(v)->status = 0;
}
else {
Py_INCREF(v);
@@ -1581,6 +1586,8 @@ current_context(void)
if (tl_context == NULL) {
return NULL;
}
+ CTX(tl_context)->status = 0;
+
if (PyDict_SetItem(dict, tls_context_key, tl_context) < 0) {
Py_DECREF(tl_context);
return NULL;
@@ -1646,6 +1653,7 @@ PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v)
if (v == NULL) {
return NULL;
}
+ CTX(v)->status = 0;
}
else {
Py_INCREF(v);