Skip to content

Commit 7c36b24

Browse files
authored
Improve error message for librt abi mismatch (#20216)
In the case where the abi does not match, it is easier to debug if we show what the expected and actual versions are.
1 parent 68d8f9d commit 7c36b24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypyc/lib-rt/librt_internal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ import_librt_internal(void)
6464
return -1;
6565
memcpy(NativeInternal_API, capsule, sizeof(NativeInternal_API));
6666
if (NativeInternal_ABI_Version() != LIBRT_INTERNAL_ABI_VERSION) {
67-
PyErr_SetString(PyExc_ValueError, "ABI version conflict for librt.internal");
67+
char err[128];
68+
snprintf(err, sizeof(err), "ABI version conflict for librt.internal, expected %d, found %d",
69+
LIBRT_INTERNAL_ABI_VERSION,
70+
NativeInternal_ABI_Version()
71+
);
72+
PyErr_SetString(PyExc_ValueError, err);
6873
return -1;
6974
}
7075
return 0;

0 commit comments

Comments
 (0)