[python] Report the dlopen failure reason from load_library - #63
[python] Report the dlopen failure reason from load_library#63conrade-ctc wants to merge 14 commits into
Conversation
…er-research#41) * [cpyrt] Improve error reporting for method calls without C++ object Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * [test] Add test for method calls on an instance without a C++ object Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Grigori Rybkine <Grigori.Rybkine@cern.ch> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…esearch#40) * [cpyrt] Penalize void* arguments in overload priority as intended * [test] Add regression test for void* overload priority --------- Co-authored-by: Emery Conrad <emery.conrad@chicagotrading.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…rch#42) Fixes the long-standing header duplication (previously `Cppyy.h` and `cpp_cppyy.h`) between cpyrt and interop, so that there is only a single source of definitions for the `cppjit::interop` API and types.
Changed definition of a function to the test it is actually used, and added a missing import
…er-research#50) Drops wheel sizes by about half. Previously the entire install tree of CppInterOp was staged that included duplicate shared libs due to versioning. This is fixed by adding a stripped shared-lib option in CppInterOp, leveraged in this patch.
…ch#52) [cpyrt] Clear the error indicator only where a call failed A debug build of CPython asserts when a C API call is made with the error indicator already set, so the __cpp_cross__ annotation, the meta_setattro fallthrough to tp_setattro, and the VectorData alias need it cleared. Clear it only on the failing path: AddToClass reports failure, and the two CPPScope sites can test the value they just produced, so an error raised elsewhere still propagates. meta_getattro returns a new reference; release it instead of leaking it.
* [test] Find eigen and boost under the Homebrew and MacPorts prefixes * [ci] Build and test manylinux and macOS arm64 wheels
…esearch#54) SetArg() created an element converter per call and appended it to fConverters, but Clear() frees only fBuffer, so the vector grew without bound across repeated std::initializer_list conversions. Create each element converter once, on first use of its index, and reuse it.
…iler-research#51) * Serialize and atomize test dictionary builds * Force loadfile scheduling for distributed test runs * Normalize the xfail marker keyword order * Correct the xfail markers and add missing reasons * Add the --run-crashing-xfails collection option * Enable strict xfail * Drop xfail markers that no longer fail on macOS and cling * Make the span tests include their own header
Cpp::LoadLibrary drops the loader message, so load_library asks the loader again with dlopen and reports its dlerror text. Co-developed-with-the-help-of: Claude Code (Opus 5, human in the loop)
There was a problem hiding this comment.
This is a nice improvement! Perhaps we could have Cpp::LoadLibrary give us the diagnostics on why it failed so we can avoid re-attempting dlopen with ctypes on the Python side.
edit: Just saw compiler-research/CppInterOp#1101, I think that would be the best solution here
|
Agreed, #1101 is the right place for this, and I think a |
We can add an optional out param to LoadLibrary and once that lands, use that in this PR (you can bump the pinned commit here so it builds with latest CppInterOp containing #1101) |
Cpp::LoadLibrary now hands back the loader's reason through an optional out-parameter (compiler-research/CppInterOp#1107), so the ctypes re-dlopen probe goes away. The pin bump to a CppInterOp commit that carries #1107 is folded in when it lands. Co-developed-with-the-help-of: Claude Code (Fable 5.1, human in the loop)
|
Opened compiler-research/CppInterOp#1107 with the optional |
Cpp::LoadLibrary drops the loader's failure reason, so load_library raises a bare error. This change asks the loader again with dlopen and reports its dlerror text, when the captured stderr is empty. A companion CppInterOp PR (compiler-research/CppInterOp#1101) emits the same reason on stderr directly; this change stands on its own if that PR lags. It adds a regression test for a missing library and a truncated ELF header.