Tidy up handling of OOM exceptions - Py*_New will call PyErr_NoMemory() internally, so there is no need to call it again here, just correctly handle the NULL return value
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
index f32afb0..8306048 100644
--- a/Lib/python/pyrun.swg
+++ b/Lib/python/pyrun.swg
@@ -296,7 +296,6 @@
           Py_DECREF(data->newraw);
           Py_DECREF(data->klass);
           free(data);
-          PyErr_NoMemory();
           return 0;
         }
       } else {
@@ -355,10 +354,7 @@
   if (!sobj->dict)
     sobj->dict = PyDict_New();
 
-  if (!sobj->dict)
-    return PyErr_NoMemory();
-
-  Py_INCREF(sobj->dict);
+  Py_XINCREF(sobj->dict);
   return sobj->dict;
 }