~crunch.io/ubuntu/precise/codespeak-lib/unstable

« back to all changes in this revision

Viewing changes to py/_code/assertion.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-08-01 16:24:01 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100801162401-g37v49d1p148alpm
Tags: 1.3.3-1
* New upstream release.
* Bump Standards-Version to 3.9.1.
* Fix typo in py.test manpage.
* Prefer Breaks: over Conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    return '\n'.join(result)
38
38
 
39
39
 
40
 
if sys.version_info >= (2, 6) or (sys.platform.startswith("java")):
41
 
    from py._code._assertionnew import interpret
42
 
else:
43
 
    from py._code._assertionold import interpret
44
 
 
45
 
 
46
40
class AssertionError(BuiltinAssertionError):
47
41
 
48
42
    def __init__(self, *args):
65
59
                # this can also occur during reinterpretation, when the
66
60
                # co_filename is set to "<run>".
67
61
            if source:
68
 
                self.msg = interpret(source, f, should_fail=True)
 
62
                self.msg = reinterpret(source, f, should_fail=True)
69
63
                if not self.args:
70
64
                    self.args = (self.msg,)
71
65
            else:
73
67
 
74
68
if sys.version_info > (3, 0):
75
69
    AssertionError.__module__ = "builtins"
 
70
    reinterpret_old = "old reinterpretation not available for py3"
 
71
else:
 
72
    from py._code._assertionold import interpret as reinterpret_old
 
73
if sys.version_info >= (2, 6) or (sys.platform.startswith("java")):
 
74
    from py._code._assertionnew import interpret as reinterpret
 
75
else:
 
76
    reinterpret = reinterpret_old
 
77