diff options
author | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
commit | 6f2df4d5e193d54244b0c2de91ef0ab1604b9243 (patch) | |
tree | 5e172400da7561eb4bb8fafc62c8cab511d74dad /Demo/metaclasses/Trace.py | |
parent | a8c360ee76fb76902a2e2140fbb38d4b06b2d9fb (diff) | |
download | cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.zip cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.gz cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.bz2 |
Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
Diffstat (limited to 'Demo/metaclasses/Trace.py')
-rw-r--r-- | Demo/metaclasses/Trace.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Demo/metaclasses/Trace.py b/Demo/metaclasses/Trace.py index 97fda56..d211d17 100644 --- a/Demo/metaclasses/Trace.py +++ b/Demo/metaclasses/Trace.py @@ -35,7 +35,7 @@ class TraceMetaClass: return base.__getattr__(name) except AttributeError: pass - raise AttributeError, name + raise AttributeError(name) def __setattr__(self, name, value): if not self.__inited: @@ -69,7 +69,7 @@ class TracingInstance: try: raw = self.__class.__getattr__(name) except AttributeError: - raise AttributeError, name + raise AttributeError(name) if type(raw) != types.FunctionType: return raw # It's a function @@ -99,7 +99,7 @@ class TracingWrapper(NotTracingWrapper): self.inst.__trace_call__(self.inst.__trace_output__, "returning from %s with exception %s: %s", self.__name__, t, v) - raise t, v, tb + raise t(v).with_traceback(tb) else: self.inst.__trace_call__(self.inst.__trace_output__, "returning from %s with value %s", @@ -117,28 +117,28 @@ def _test(): def m2(self, y): return self.x + y __trace_output__ = sys.stdout class D(C): - def m2(self, y): print "D.m2(%r)" % (y,); return C.m2(self, y) + def m2(self, y): print("D.m2(%r)" % (y,)); return C.m2(self, y) __trace_output__ = None x = C(4321) - print x - print x.x - print x.m1(100) - print x.m1(10) - print x.m2(33) - print x.m1(5) - print x.m2(4000) - print x.x - - print C.__init__ - print C.m2 - print D.__init__ - print D.m2 + print(x) + print(x.x) + print(x.m1(100)) + print(x.m1(10)) + print(x.m2(33)) + print(x.m1(5)) + print(x.m2(4000)) + print(x.x) + + print(C.__init__) + print(C.m2) + print(D.__init__) + print(D.m2) y = D() - print y - print y.m1(10) - print y.m2(100) - print y.x + print(y) + print(y.m1(10)) + print(y.m2(100)) + print(y.x) if __name__ == '__main__': _test() |