Commits

Michael Foord  committed 28183f0 Merge

Merge

  • Participants
  • Parent commits bd52c83, 0ed7da7

Comments (0)

Files changed (2)

File Lib/test/test_decimal.py

 
         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):
 

File Modules/_decimal/_decimal.c

   {"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}
 };
 
     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 */