introduce py.builtin._sysex as alias for the special exceptions, fixes #115
--HG-- branch : trunk
This commit is contained in:
parent
04b3b9a3da
commit
b81e48507c
|
@ -4,6 +4,7 @@ Changes between 1.3.3 and 1.3.4
|
|||
- fix issue111: improve install documentation for windows
|
||||
- fix issue116: --doctestmodules works in the presence of __init__.py files as well
|
||||
- fix issue118: new --tb=native option for presenting cpython-standard exceptions
|
||||
- fix issue115: introduce py.builtin._sysex for system level exceptions we should thread different
|
||||
|
||||
Changes between 1.3.2 and 1.3.3
|
||||
==================================================
|
||||
|
|
|
@ -111,6 +111,7 @@ py.apipkg.initpkg(__name__, dict(
|
|||
'frozenset' : '._builtin:frozenset',
|
||||
'BaseException' : '._builtin:BaseException',
|
||||
'GeneratorExit' : '._builtin:GeneratorExit',
|
||||
'_sysex' : '._builtin:_sysex',
|
||||
'print_' : '._builtin:print_',
|
||||
'_reraise' : '._builtin:_reraise',
|
||||
'_tryimport' : '._builtin:_tryimport',
|
||||
|
|
|
@ -87,6 +87,8 @@ except NameError:
|
|||
pass
|
||||
GeneratorExit.__module__ = 'exceptions'
|
||||
|
||||
_sysex = (KeyboardInterrupt, SystemExit, MemoryError, GeneratorExit)
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
exec ("print_ = print ; exec_=exec")
|
||||
import builtins
|
||||
|
|
|
@ -3,7 +3,7 @@ import sys, inspect
|
|||
from compiler import parse, ast, pycodegen
|
||||
from py._code.assertion import BuiltinAssertionError, _format_explanation
|
||||
|
||||
passthroughex = (KeyboardInterrupt, SystemExit, MemoryError)
|
||||
passthroughex = py.builtin._sysex
|
||||
|
||||
class Failure:
|
||||
def __init__(self, node):
|
||||
|
|
|
@ -44,7 +44,7 @@ class AssertionError(BuiltinAssertionError):
|
|||
if args:
|
||||
try:
|
||||
self.msg = str(args[0])
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
except py.builtin._sysex:
|
||||
raise
|
||||
except:
|
||||
self.msg = "<[broken __repr__] %s at %0xd>" %(
|
||||
|
|
|
@ -189,7 +189,7 @@ class TracebackEntry(object):
|
|||
"""
|
||||
try:
|
||||
return self.frame.eval("__tracebackhide__")
|
||||
except (SystemExit, KeyboardInterrupt):
|
||||
except py.builtin._sysex:
|
||||
raise
|
||||
except:
|
||||
return False
|
||||
|
|
|
@ -276,7 +276,7 @@ def getfslineno(obj):
|
|||
def findsource(obj):
|
||||
try:
|
||||
sourcelines, lineno = py.std.inspect.findsource(obj)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
except py.builtin._sysex:
|
||||
raise
|
||||
except:
|
||||
return None, None
|
||||
|
|
|
@ -5,8 +5,6 @@ builtin_repr = repr
|
|||
|
||||
reprlib = py.builtin._tryimport('repr', 'reprlib')
|
||||
|
||||
sysex = (KeyboardInterrupt, MemoryError, SystemExit)
|
||||
|
||||
class SafeRepr(reprlib.Repr):
|
||||
""" subclass of repr.Repr that limits the resulting size of repr()
|
||||
and includes information on exceptions raised during the call.
|
||||
|
@ -21,7 +19,7 @@ class SafeRepr(reprlib.Repr):
|
|||
try:
|
||||
# Try the vanilla repr and make sure that the result is a string
|
||||
s = call(x, *args)
|
||||
except sysex:
|
||||
except py.builtin._sysex:
|
||||
raise
|
||||
except:
|
||||
cls, e, tb = sys.exc_info()
|
||||
|
|
|
@ -26,7 +26,7 @@ def _getdimensions():
|
|||
def get_terminal_width():
|
||||
try:
|
||||
height, width = _getdimensions()
|
||||
except (SystemExit, KeyboardInterrupt):
|
||||
except py.builtin._sysex:
|
||||
raise
|
||||
except:
|
||||
# FALLBACK
|
||||
|
|
|
@ -102,7 +102,7 @@ class Node(object):
|
|||
return getattr(self, attrname)
|
||||
try:
|
||||
res = function()
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
except py.builtin._sysex:
|
||||
raise
|
||||
except:
|
||||
failure = py.std.sys.exc_info()
|
||||
|
|
Loading…
Reference in New Issue