-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python directors will not work if C++ exceptions are disabled #315
Comments
I just want to make sure you have explored using the "director:except" feature? |
Hi William, Unfortunately, there are four places where director.swig contains throw/try I had a quick look at directorthrows, and my understanding is that it is I am curious how Java is managing to do directors without c++ exceptions. I'll share a patch in a bit so you can see what I'm up to. Thanks, On Thu Jan 29 2015 at 12:25:39 PM William S Fulton [email protected]
|
Looks like It's possible it is used in user SWIG interface files. It's undocumented in the manual or CHANGES file though. The only references in Debian codesearch seem to be in generated wrappers or SWIG itself, which suggests it isn't used in anything packaged for Debian at least: http://codesearch.debian.net/results/UnknownExceptionHandler/page_1 I think it's pretty safe to remove. |
Yeah, my patch just removes it UnknownExceptionHandler as I had concluded Here is what I have right now. I'd love comments. I still need to write On Thu Jan 29 2015 at 1:30:32 PM Olly Betts [email protected]
|
That seems to be some sort of internal to google link. I'd suggest we just drop |
Sorry, I missed that this was going outside google. I need to get approval We can drop it, but there will still be exception use so dropping it isn't On Thu Jan 29 2015 at 2:18:44 PM Olly Betts [email protected]
|
On 29 January 2015 at 21:30, Olly Betts [email protected] wrote:
Okay, let's do the easy bit first and have a separate patch to remove this |
On 29 January 2015 at 20:51, blaisegassend [email protected] wrote:
William |
I just went to remove The So I think we should probably revert 37a08a2 and add a testcase to make sure this doesn't get regressed again. For this issue, a patch to allow SWIG to generate wrappers without using exceptions would not generate that code, or generate it protected by |
Thanks for digging into that. I think that code that wants to run without exceptions should be able Is there a way to set that flag from the swig file? I expected that putting On Thu Jan 29 2015 at 3:58:50 PM Olly Betts [email protected]
|
I just updated the patch. This version actually works, but the On Thu Jan 29 2015 at 3:05:02 PM William S Fulton [email protected]
|
I was being stupid. This works just fine for disabling UEH (I was writing |
OK, you can see my current patch here: I'm not super happy with it because I used %insert("director_error") as the I'm open to suggestions on what the best mechanism to use is as I'm not It is past my bedtime to look properly right now, but the best example
I'm not actually trying to solve the hard problem of propagating the |
Hi, Just wanted to see if you'd had a chance to look at the patch. In Thanks, On Thu Jan 29 2015 at 10:15:52 PM Blaise Gassend [email protected] wrote:
|
Is there any example of a %feature that makes sense only globally? On Mon Feb 02 2015 at 10:12:24 AM Blaise Gassend [email protected] wrote:
|
Ping? On Tue Feb 03 2015 at 11:07:12 AM Blaise Gassend [email protected] wrote:
|
Not having heard back, I'm wondering if my previous patch was considered https://github.com/swig/swig/pull/349/files On Mon, Feb 9, 2015 at 11:19 AM Blaise Gassend [email protected] wrote:
|
Hi William, No pressure, but I wanted to make sure you're getting the emails in this thread. I'd like to use directors to make unit-testing the argument parsing in my SWIG APIs easier. Directors would allow me to write those tests without having to write any C++ boiler plate, and only a line or two of Python per method in the API. Unfortunately, Google doesn't allow exceptions to be used, and won take patches to SWIG except if they are also present upstream. So I'm stuck on getting my unit-tests committed. Thanks, |
FWIW, I can't think of any PR #349 looks a plausible approach, though I'd like to see what @wsfulton thinks. Regarding my note above, which I suspect has been forgotten:
If I don't hear anything against doing so, I'll take silence as agreement that 37a08a2 should be reverted. |
Given that the UnknownExceptionHandler can be disabled using a #define, it On Wed, Mar 11, 2015 at 2:25 PM Olly Betts [email protected] wrote:
|
That part of my comment was aimed at William, since it's his commit I'd be reverting. |
oops, I've just seen all the comments pinging me, sorry, I've somehow messed up tracking this issue in gmail, so sorry for slowing things down. Anyway...
|
Eh? The removed code was for Python and Ruby, not Java... But if we don't revert that commit, we should remove |
b655d31 removed
As discussed above the "never used" isn't really true, but removal seems a reasonable option and deals with part of this issue. @blaisegassend Did you give up on the rest of this? Realistically it's only likely to get done by someone motivated by an organisational "no exceptions" policy. |
Currently python directors rely on C++ exceptions to raise various errors that can occur when trying to call a method that is implemented in Python. Code bases that do not allow exceptions can therefore not use python directors, which is unfortunate.
It appears that there are two uses of exceptions:
My proposed solution is:
If anybody sees an issue with this solution let me know. I'll be submitting a patch shortly and would prefer for it not to be controversial once it is written.
The text was updated successfully, but these errors were encountered: