[pypy-commit] pypy py3k: add a more useful repr for OperationError, and add a warning when using pycode.dump()
antocuni
noreply at buildbot.pypy.org
Tue Feb 14 17:28:12 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52461:986f8604e616
Date: 2012-02-14 12:13 +0100
http://bitbucket.org/pypy/pypy/changeset/986f8604e616/
Log: add a more useful repr for OperationError, and add a warning when
using pycode.dump()
diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -59,6 +59,10 @@
s = self._compute_value()
return '[%s: %s]' % (self.w_type, s)
+ def __repr__(self):
+ "NOT_RPYTHON"
+ return 'OperationError(%s)' % (self.w_type)
+
def errorstr(self, space, use_repr=False):
"The exception class and value, as a string."
w_value = self.get_w_value(space)
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -287,6 +287,8 @@
def dump(self):
"""A dis.dis() dump of the code object."""
+ print 'WARNING: dumping a py3k bytecode using python2 opmap, the result might be inaccurate or wrong'
+ print
co = self._to_code()
dis.dis(co)
More information about the pypy-commit
mailing list