Skip to content

Commit fd75a25

Browse files
ndonyapourmr-c
authored andcommitted
fix the pickling error for IO objects
1 parent 56913e7 commit fd75a25

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cwltool/context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import copy
33
import os
44
import shutil
5-
import sys
65
import tempfile
76
import threading
87
from typing import (
@@ -199,7 +198,7 @@ def __init__(self, kwargs: Optional[Dict[str, Any]] = None) -> None:
199198
self.default_stdout: Optional[Union[IO[bytes], TextIO]] = None
200199
self.default_stderr: Optional[Union[IO[bytes], TextIO]] = None
201200
self.validate_only: bool = False
202-
self.validate_stdout: Union[IO[bytes], TextIO, IO[str]] = sys.stdout
201+
self.validate_stdout: Optional[Union[IO[bytes], TextIO, IO[str]]] = None
203202
super().__init__(kwargs)
204203
if self.tmp_outdir_prefix == "":
205204
self.tmp_outdir_prefix = self.tmpdir_prefix

tests/test_subclass_mypyc.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,12 @@ def test_serialize_builder() -> None:
8181
"docker",
8282
)
8383
assert pickle.dumps(builder)
84+
85+
86+
def test_pickle_unpickle_runtime_context() -> None:
87+
"""We can pickle & unpickle RuntimeContext"""
88+
89+
runtime_context = RuntimeContext()
90+
stream = pickle.dumps(runtime_context)
91+
assert stream
92+
assert pickle.loads(stream)

0 commit comments

Comments
 (0)