Skip to content

Commit 71433fd

Browse files
committed
Fix crash due to unpicklable exc_info
1 parent 1109c38 commit 71433fd

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

colcon_core/package_identification/python.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import multiprocessing
66
import os
7-
import traceback
87
from typing import Optional
98

109
from colcon_core.dependency_descriptor import DependencyDescriptor
@@ -90,13 +89,13 @@ def get_setup_result(setup_py, *, env: Optional[dict]):
9089
p.start()
9190
p.join()
9291
with conn_recv:
93-
result_or_exc_info = conn_recv.recv()
92+
result_or_exception_string = conn_recv.recv()
9493

95-
if isinstance(result_or_exc_info, dict):
96-
return result_or_exc_info
94+
if isinstance(result_or_exception_string, dict):
95+
return result_or_exception_string
9796
raise RuntimeError(
9897
'Failure when trying to run setup script {}:\n{}'
99-
.format(setup_py, traceback.format_exception(*result_or_exc_info)))
98+
.format(setup_py, result_or_exception_string))
10099

101100

102101
def _get_setup_result_target(setup_py: str, env: Optional[dict], conn_send):
@@ -108,11 +107,11 @@ def _get_setup_result_target(setup_py: str, env: Optional[dict], conn_send):
108107
109108
:param setup_py: Absolute path to a setup.py script
110109
:param env: Environment variables to set before running setup.py
111-
:param conn_send: Connection to send the result as either a dict or the
112-
result of sys.exc_info
110+
:param conn_send: Connection to send the result as either a dict or an
111+
error string
113112
"""
114113
import distutils.core
115-
import sys
114+
import traceback
116115
try:
117116
# need to be in setup.py's parent dir to detect any setup.cfg
118117
os.chdir(os.path.dirname(setup_py))
@@ -140,7 +139,7 @@ def _get_setup_result_target(setup_py: str, env: Optional[dict], conn_send):
140139
and not attr.startswith('_')
141140
)})
142141
except BaseException:
143-
conn_send.send(sys.exc_info())
142+
conn_send.send(traceback.format_exc())
144143
raise
145144

146145

0 commit comments

Comments
 (0)