Commit 26f31109 authored by Carlos Ramos Carreño's avatar Carlos Ramos Carreño Committed by Jérome Perrin

Fixes the error in test_onErrorCallback.

The test testCMFActivity.TestCMFActivity.test_onErrorCallback was
failing because some weak references were not dropped.
The reason was that _DequeueMessageException was declared as global
and it kept a traceback including the variables pointed by the weak
references, preventing their garbage collection.
This was fixed by using a class for the _DequeueMessageException
instead of a singleton, and creating a new instance on every raise.
parent dd35bcbf
......@@ -83,7 +83,8 @@ def sort_message_key(message):
# same sort key as in SQLBase.getMessageList
return message.line.priority, message.line.date, message.uid
_DequeueMessageException = Exception()
class _DequeueMessageException(Exception):
pass
_ITEMGETTER0 = operator.itemgetter(0)
_IDENTITY = lambda x: x
......@@ -1010,11 +1011,11 @@ CREATE TABLE %s (
# increased.
for m in message_list:
if m.getExecutionState() == MESSAGE_NOT_EXECUTED:
raise _DequeueMessageException
raise _DequeueMessageException()
transaction.commit()
except:
exc_info = sys.exc_info()
if exc_info[1] is not _DequeueMessageException:
if not isinstance(exc_info[1], _DequeueMessageException):
self._log(WARNING,
'Exception raised when invoking messages (uid, path, method_id) %r'
% [(m.uid, m.object_path, m.method_id) for m in message_list])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment