Skip to content

Commit e28fb93

Browse files
committed
Merge pull request #208 in LCL/wolframclientforpython from bugfix/377082-throw to master
* commit 'fc209a0d9c8acc8c339a77f576157970367a75e9': Use in place update. Minor fix in init script adding test also for 2 argument throw refactor adding a test performing BinarySerialize outside EvaluationData
2 parents ac5a9fb + fc209a0 commit e28fb93

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

wolframclient/evaluation/kernel/initkernel.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,16 @@ no matter the total size (tested with 80MB) *)
139139
socketEventHandler[data_] := Block[
140140
{expr},
141141
ClientLibrary`debug["Evaluating a new expression."];
142-
expr = EvaluationData[BinarySerialize[BinaryDeserialize[data]]];
142+
expr = EvaluationData[BinaryDeserialize[data]];
143143
(* Produce inline InputForm string messages. *)
144144
AssociateTo[
145-
expr,
146-
"MessagesText" -> Map[
147-
fmtmsg,
148-
expr["MessagesExpressions"]
149-
]
145+
expr, {
146+
"Result" -> BinarySerialize[expr["Result"]],
147+
"MessagesText" -> Map[
148+
fmtmsg,
149+
expr["MessagesExpressions"]
150+
]
151+
}
150152
];
151153
ClientLibrary`debug["Done evaluating."];
152154
SocketWriteByteArrayFunc[
@@ -156,7 +158,6 @@ no matter the total size (tested with 80MB) *)
156158
ClientLibrary`debug["Done responding."];
157159
];
158160

159-
160161
SendAck[] := WriteString[$OutputSocket, "OK"]
161162

162163
$MaxIdlePause=.001;

wolframclient/tests/configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _parse_config(config):
106106
try:
107107
with open(expended_path, "r") as fp:
108108
json_config = json.load(fp)
109-
secured_authentication_key, user_configuration, server, kernel_path, api_owner= _parse_config(
109+
secured_authentication_key, user_configuration, server, kernel_path, api_owner = _parse_config(
110110
json_config
111111
)
112112
except IOError:

wolframclient/tests/evaluation/test_coroutine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
LOOP = get_event_loop()
2929

30+
3031
class TestCoroutineSession(BaseTestCase):
3132
@classmethod
3233
def setUpClass(cls):

wolframclient/tests/evaluation/test_kernel.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ def test_stop_start_restart_status(self):
287287
self.assertFalse(session.started)
288288
self.assertTrue(session.stopped)
289289

290+
def test_throw(self):
291+
292+
self.assertEqual(self.kernel_session.evaluate(wl.Throw(2)), wl.Hold(wl.Throw(2)))
293+
self.assertEqual(
294+
self.kernel_session.evaluate(wl.Throw(2, "foo")), wl.Hold(wl.Throw(2, "foo"))
295+
)
296+
290297

291298
class TestSessionTimeout(TestCaseSettings):
292299
def test_evaluate_async_basic_inputform(self):

0 commit comments

Comments
 (0)