mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Fixed fix in the interpreter.
This commit is contained in:
parent
740a57d78a
commit
445e76bef7
20
src/fix.py
20
src/fix.py
@ -199,13 +199,19 @@ if not hasattr(socket, 'sslerror'):
|
||||
socket.sslerror = socket.error
|
||||
|
||||
# Trick to get an __revision__ attribute in all exceptions, if possible.
|
||||
Exception__init__ = Exception.__init__
|
||||
def __init__(self, *args, **kwargs):
|
||||
caller = sys._getframe(1)
|
||||
module = sys.modules.get(caller.f_globals.get('__name__'))
|
||||
self.__revision__ = getattr(module, '__revision__', None)
|
||||
Exception__init__(self, *args, **kwargs)
|
||||
Exception.__init__ = __init__
|
||||
if not hasattr(Exception, '_original__init__'):
|
||||
Exception._original__init__ = Exception.__init__
|
||||
def __init__(self, *args, **kwargs):
|
||||
# We had sys._getframe(1) here for awhile, but in the interactive
|
||||
# interpreter, there isn't enough call stack. Thanks, Rafterman, for
|
||||
# pointing that out.
|
||||
me = sys._getframe(0)
|
||||
caller = me.f_back
|
||||
callerGlobals = getattr(caller, 'f_globals', {})
|
||||
callerModule = sys.modules.get(callerGlobals.get('__name__'))
|
||||
self.__revision__ = getattr(callerModule, '__revision__', None)
|
||||
self._original__init__(*args, **kwargs)
|
||||
Exception.__init__ = __init__
|
||||
|
||||
|
||||
for name in exported:
|
||||
|
Loading…
Reference in New Issue
Block a user