Python Fault Handling#22
Conversation
| }; | ||
|
|
||
| PYBIND11_PLUGIN(hnswlib) | ||
| PYBIND11_PLUGIN(cpp_bindings) |
There was a problem hiding this comment.
does this change the name of the module / what does this change do?
There was a problem hiding this comment.
this changes the name of the python bindings package
| "./hnswlib", | ||
| ] | ||
|
|
||
| # compatibility when run in python_bindings |
There was a problem hiding this comment.
just for my understanding - why is this ok to remove?
There was a problem hiding this comment.
this was additional complexity for if you wanted to run setup.py inside the python_bindings directory - we don't need that.
| ext_modules = [ | ||
| Extension( | ||
| "hnswlib", | ||
| "hnswlib.cpp_bindings", |
There was a problem hiding this comment.
for my understanding - is this the module path
There was a problem hiding this comment.
yes, this is the module path for the extension module being added here, in this case the cpp bindings are now a submodule of the hnswlib module
| @@ -0,0 +1,4 @@ | |||
| import faulthandler | |||
| from .cpp_bindings import * | |||
There was a problem hiding this comment.
so this is the rexport that makes everything appear under hnswlib?
HammadB
left a comment
There was a problem hiding this comment.
This makes sense broadly, just have some questions for my understanding.
Repackaging to add the python
faulthandlerto help better identify issues in the python bindings when / if they happen.You can test the effects of this by checking out and building 6ede4f5
This adds two methods to
hnswlib-raise_segvandraise_abort- calling these will cause a crash, but the faulthandler will catch it and produce at least part of a stack trace before the interpreter exits. This is reverted in the subsequent commit.This PR also expands python tests to 3.11 and 3.12, and removes the examples folder from tests. The reason to remove the examples folder is because there are no tests in it, and the 3.12 version of unittest returns code 5 if no tests are run - this is better procedurally, and the actual bindings tests plus the C++ tests exercise the full surface.