# HG changeset patch # User Andrey Skvortsov # Date 1538556297 -10800 # Node ID c081dabc0f63b9fdfbb1b0f6f1e41dad93dbbd04 # Parent 5587c490a070ec2d8f3a6206c11c2c6d89b1593d Fix old style exception raise and exec syntax diff -r 5587c490a070 -r c081dabc0f63 runtime/PLCObject.py --- a/runtime/PLCObject.py Tue Oct 02 18:08:49 2018 +0300 +++ b/runtime/PLCObject.py Wed Oct 03 11:44:57 2018 +0300 @@ -32,6 +32,7 @@ from time import time import _ctypes # pylint: disable=wrong-import-order import Pyro.core as pyro +import six from runtime.typemapping import TypeTranslator from runtime.loglevels import LogLevelsDefault, LogLevelsCount @@ -147,7 +148,10 @@ if _job.success: return _job.result else: - raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2] + exc_type = _job.exc_info[0] + exc_value = _job.exc_info[1] + exc_traceback = _job.exc_info[2] + six.reraise(exc_type, exc_value, exc_traceback) def quit(self): """ @@ -697,7 +701,7 @@ def RemoteExec(self, script, *kwargs): try: - exec script in kwargs + exec(script, kwargs) except Exception: _e_type, e_value, e_traceback = sys.exc_info() line_no = traceback.tb_lineno(get_last_traceback(e_traceback)) diff -r 5587c490a070 -r c081dabc0f63 tests/tools/test_application.py --- a/tests/tools/test_application.py Tue Oct 02 18:08:49 2018 +0300 +++ b/tests/tools/test_application.py Wed Oct 03 11:44:57 2018 +0300 @@ -30,6 +30,7 @@ import unittest import time +import six import pytest import wx import ddt @@ -71,7 +72,10 @@ def CheckForErrors(self): if self.exc_info is not None: # reraise catched previously exception - raise self.exc_info[0], self.exc_info[1], self.exc_info[2] + exc_type = self.exc_info[0] + exc_value = self.exc_info[1] + exc_traceback = self.exc_info[2] + six.reraise(exc_type, exc_value, exc_traceback) def ProcessEvents(self): for dummy in range(0, 30):