'throw' annotation support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PyBindGen |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Opening bug per https:/
- Suppose you have a function or method without exception specification (throw (blah) stanza) in C++ declaration.
- According to C++ spec it may throw anything, however PBG doesn't translate C++ exceptions out of a box, and exception escaping such function to Python ends up in terminate()
- Adding 'throw' annotation in pre_scan_hook yields a warning that annotation has no effect, and indeed it doesn't.
Therefore please consider
1. Implementing support for 'throw' annotation
2. Translating std::exception on C++ method/function lacking exception specification.
I believe 1 is genuine missing functionality, and 2 is more of a 'nice to have', as it doesn't address exceptions not inherited from std::exception, but in practice it is a common case, as many projects adopt a binary view of the world -- function either throws and then has no specification or doesn't and then has "throw()" specification, furthermore majority uses exceptions inherited from std::exception anyway, so supporting this case will make it "just work" for many people out of the box.
Related branches
Changed in pybindgen: | |
status: | New → Fix Committed |
Changed in pybindgen: | |
status: | Fix Committed → Fix Released |
Regarding 2, I am not sure is a good idea. There is surely some runtime overhead when always catching exceptions in every wrapped function/method. At most, I am willing to add it as an option that is disabled by default.