From 0dd0630a4ea0b8bca41feadea61a6490bce90efb Mon Sep 17 00:00:00 2001 From: "mhammond%skippinet.com.au" Date: Fri, 9 Sep 2005 14:36:29 +0000 Subject: [PATCH] Clear the current Python error when returning an error code to xpcom git-svn-id: svn://10.0.0.236/branches/DOM_AGNOSTIC_BRANCH@179903 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/python/xpcom/src/ErrorUtils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mozilla/extensions/python/xpcom/src/ErrorUtils.cpp b/mozilla/extensions/python/xpcom/src/ErrorUtils.cpp index 55d7dfa508e..69715ab1bc2 100644 --- a/mozilla/extensions/python/xpcom/src/ErrorUtils.cpp +++ b/mozilla/extensions/python/xpcom/src/ErrorUtils.cpp @@ -225,6 +225,14 @@ nsresult PyXPCOM_SetCOMErrorFromPyException() if (!PyErr_Occurred()) // No error occurred return NS_OK; + // todo: + // * Translate PyExc_MemoryError to NS_ERROR_OUT_OF_MEMORY + // * Set an exception using the exception service. + + // Once we have returned to pyxpcom, we don't want to leave a + // Python exception pending - it may get noticed when the next call + // is made on the same thread. + PyErr_Clear(); return NS_ERROR_FAILURE; }