[pypy-svn] r39748 - pypy/dist/pypy/translator/goal
arigo at codespeak.net
arigo at codespeak.net
Fri Mar 2 20:30:55 CET 2007
Author: arigo
Date: Fri Mar 2 20:30:53 2007
New Revision: 39748
Modified:
pypy/dist/pypy/translator/goal/app_main.py
pypy/dist/pypy/translator/goal/targetpypystandalone.py
Log:
Move DEBUG to app_main. I think that now this hides the "debug:"s that
are expected and shows the "debug:"s that should not occur unless
something went very wrong.
Modified: pypy/dist/pypy/translator/goal/app_main.py
==============================================================================
--- pypy/dist/pypy/translator/goal/app_main.py (original)
+++ pypy/dist/pypy/translator/goal/app_main.py Fri Mar 2 20:30:53 2007
@@ -15,6 +15,8 @@
import sys, os
+DEBUG = False # dump exceptions before calling the except hook
+
originalexcepthook = sys.__excepthook__
def run_toplevel(f, *fargs, **fkwds):
@@ -61,9 +63,8 @@
except:
etype, evalue, etraceback = sys.exc_info()
try:
- # XXX extra debugging info in case the code below goes very wrong
- # XXX (temporary)
- if hasattr(sys, 'stderr'):
+ # extra debugging info in case the code below goes very wrong
+ if DEBUG and hasattr(sys, 'stderr'):
s = getattr(etype, '__name__', repr(etype))
print >> sys.stderr, "debug: exception-type: ", s
print >> sys.stderr, "debug: exception-value:", str(evalue)
Modified: pypy/dist/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypystandalone.py (original)
+++ pypy/dist/pypy/translator/goal/targetpypystandalone.py Fri Mar 2 20:30:53 2007
@@ -12,16 +12,13 @@
thisdir = py.magic.autopath().dirpath()
app_basic_example_path = str(thisdir.join("app_basic_example.py"))
-DEBUG = False
-
try:
this_dir = os.path.dirname(__file__)
except NameError:
this_dir = os.path.dirname(sys.argv[0])
def debug(msg):
- if DEBUG:
- os.write(2, "debug: " + msg + '\n')
+ os.write(2, "debug: " + msg + '\n')
# __________ Entry point __________
@@ -32,9 +29,9 @@
w_call_startup_gateway = space.wrap(gateway.interp2app(call_startup))
def entry_point(argv):
- debug("entry point starting")
- for arg in argv:
- debug(" argv -> " + arg)
+ #debug("entry point starting")
+ #for arg in argv:
+ # debug(" argv -> " + arg)
try:
try:
space.call_function(w_run_toplevel, w_call_startup_gateway)
More information about the Pypy-commit
mailing list