diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/codeunit.py | 22 | ||||
-rw-r--r-- | coverage/execfile.py | 4 |
2 files changed, 22 insertions, 4 deletions
diff --git a/coverage/codeunit.py b/coverage/codeunit.py index 87782cd..7f4ed96 100644 --- a/coverage/codeunit.py +++ b/coverage/codeunit.py @@ -83,8 +83,26 @@ class CodeUnit: def __repr__(self): return "<CodeUnit name=%r filename=%r>" % (self.name, self.filename) - def __cmp__(self, other): - return cmp(self.name, other.name) + # Annoying comparison operators. Py3k wants __lt__ etc, and Py2k needs all + # of them defined. + + def __lt__(self, other): + return self.name < other.name + + def __le__(self, other): + return self.name <= other.name + + def __eq__(self, other): + return self.name == other.name + + def __ne__(self, other): + return self.name != other.name + + def __gt__(self, other): + return self.name > other.name + + def __ge__(self, other): + return self.name >= other.name def flat_rootname(self): """A base for a flat filename to correspond to this code unit. diff --git a/coverage/execfile.py b/coverage/execfile.py index 09947bc..a345c76 100644 --- a/coverage/execfile.py +++ b/coverage/execfile.py @@ -6,8 +6,8 @@ try: # In Py 2.x, the builtins were in __builtin__ BUILTINS = sys.modules['__builtin__'] except KeyError: - # In Py 3.x, they're in builtin - BUILTINS = sys.modules['builtin'] + # In Py 3.x, they're in builtins + BUILTINS = sys.modules['builtins'] def run_python_file(filename, args): |