Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions priv/python3/erlport/erlang.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from inspect import getargspec
import sys
from sys import exc_info
from traceback import extract_tb
from traceback import extract_tb, format_list
from threading import Lock
import uuid

Expand Down Expand Up @@ -236,12 +236,16 @@ def _call_with_error_handler(self, mid, function, *args):
exc = Atom(bytes("%s.%s" % (t.__module__, t.__name__), "utf-8"))
exc_tb = extract_tb(tb)
exc_tb.reverse()
error = Atom(b"python"), exc, str(val), exc_tb
decoded_tb = self._decode_traceback(exc_tb)
error = Atom(b"python"), exc, str(val), decoded_tb
if mid is not None:
result = Atom(b"e"), mid, error
else:
result = Atom(b"e"), error
self.port.write(result)

def _decode_traceback(self, stack_summary):
return bytes(''.join(format_list(stack_summary)), "utf-8")

def setup_api_functions(handler):
global call, cast, self, make_ref
Expand Down