diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-08-29 00:48:39 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-08-29 00:48:39 +0000 |
commit | 8253cc047de523fd2097e4d85417316ff9a37ad5 (patch) | |
tree | aebb560a5ab50501e7075925221f4d9382e428fc /utils/lit | |
parent | aee279dad51c0ac10360973509197c9e5f39f4b0 (diff) | |
download | external_llvm-8253cc047de523fd2097e4d85417316ff9a37ad5.zip external_llvm-8253cc047de523fd2097e4d85417316ff9a37ad5.tar.gz external_llvm-8253cc047de523fd2097e4d85417316ff9a37ad5.tar.bz2 |
[lit] Change lit.Test.ResultCode to be unique across pickling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/Test.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/lit/lit/Test.py b/utils/lit/lit/Test.py index 59ca694..05cae99 100644 --- a/utils/lit/lit/Test.py +++ b/utils/lit/lit/Test.py @@ -5,6 +5,17 @@ import os class ResultCode(object): """Test result codes.""" + # We override __new__ and __getnewargs__ to ensure that pickling still + # provides unique ResultCode objects in any particular instance. + _instances = {} + def __new__(cls, name, isFailure): + res = cls._instances.get(name) + if res is None: + cls._instances[name] = res = super(ResultCode, cls).__new__(cls) + return res + def __getnewargs__(self): + return (self.name, self.isFailure) + def __init__(self, name, isFailure): self.name = name self.isFailure = isFailure |