[Python-checkins] cpython (merge default -> default): Merge
michael.foord
python-checkins at python.org
Sun Mar 25 19:16:24 CEST 2012
http://hg.python.org/cpython/rev/28183f010a05
changeset: 75925:28183f010a05
parent: 75924:bd52c8331dac
parent: 75923:0ed7da703a33
user: Michael Foord <michael at voidspace.org.uk>
date: Sun Mar 25 18:16:26 2012 +0100
summary:
Merge
files:
Lib/test/test_decimal.py | 2 +-
Modules/_decimal/_decimal.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -3837,7 +3837,7 @@
x = dir(C)
y = [s for s in dir(P) if '__' in s or not s.startswith('_')]
- self.assertEqual(set(x) - set(y), {'MallocError'})
+ self.assertEqual(set(x) - set(y), set())
def test_context_attributes(self):
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -168,7 +168,9 @@
{"DivisionImpossible", "decimal.DivisionImpossible", MPD_Division_impossible, NULL},
{"DivisionUndefined", "decimal.DivisionUndefined", MPD_Division_undefined, NULL},
{"InvalidContext", "decimal.InvalidContext", MPD_Invalid_context, NULL},
+#ifdef EXTRA_FUNCTIONALITY
{"MallocError", "decimal.MallocError", MPD_Malloc_error, NULL},
+#endif
{NULL}
};
@@ -466,9 +468,14 @@
mpd_context_t *ctx = CTX(context);
ctx->status |= status;
- if (ctx->traps&status) {
+ if (status & (ctx->traps|MPD_Malloc_error)) {
PyObject *ex, *siglist;
+ if (status & MPD_Malloc_error) {
+ PyErr_NoMemory();
+ return 1;
+ }
+
ex = flags_as_exception(ctx->traps&status);
if (ex == NULL) {
return 1; /* GCOV_NOT_REACHED */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list