Skip to content

Commit 517b6a2

Browse files
committed
Fix python 3.8/3.9 compat
1 parent c207e24 commit 517b6a2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/semiwrap/hooks.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,16 @@ def initialize(self, version: str, build_data: T.Dict[str, T.Any]) -> None:
6969
raise
7070

7171
msg = [
72-
"ERROR: exception occurred when processing `pyproject.toml`",
73-
"",
72+
"ERROR: exception occurred when processing `pyproject.toml`\n\n",
7473
]
7574

76-
msg += traceback.format_exception_only(e)
75+
msg += traceback.format_exception_only(type(e), e)
7776
cause = e.__context__
7877
while cause is not None:
7978
if "prepare_metadata_for_build_editable" in str(cause):
8079
break
8180

82-
el = traceback.format_exception_only(cause)
81+
el = traceback.format_exception_only(type(cause), cause)
8382
el[0] = f"- caused by {el[0]}"
8483
msg += el
8584

@@ -89,10 +88,10 @@ def initialize(self, version: str, build_data: T.Dict[str, T.Any]) -> None:
8988
cause = cause.__context__
9089

9190
msg.append(
92-
"Set environment variable SEMIWRAP_ERROR_VERBOSE=1 for stacktrace"
91+
"\nSet environment variable SEMIWRAP_ERROR_VERBOSE=1 for stacktrace"
9392
)
9493

95-
print("\n".join(msg), file=sys.stderr)
94+
print("".join(msg), file=sys.stderr)
9695
sys.exit(1)
9796

9897
if eps:

0 commit comments

Comments
 (0)