Skip to content

Commit

Permalink
add calls to jl_exception_clear to interface functions with try blocks
Browse files Browse the repository at this point in the history
this prevents swallowed exceptions from appearing as errors when you
call jl_exception_occurred.
  • Loading branch information
JeffBezanson committed Mar 13, 2014
1 parent c3601d4 commit 9785017
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/jlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ DLLEXPORT void *jl_eval_string(char *str)
JL_GC_PUSH1(&ast);
r = jl_toplevel_eval(ast);
JL_GC_POP();
jl_exception_clear();
}
JL_CATCH {
//jl_show(jl_stderr_obj(), jl_exception_in_transit);
Expand Down Expand Up @@ -142,6 +143,7 @@ DLLEXPORT jl_value_t *jl_call(jl_function_t *f, jl_value_t **args, int32_t nargs
argv[i] = args[i-1];
v = jl_apply(f, args, nargs);
JL_GC_POP();
jl_exception_clear();
}
JL_CATCH {
v = NULL;
Expand All @@ -156,6 +158,7 @@ DLLEXPORT jl_value_t *jl_call0(jl_function_t *f)
JL_GC_PUSH1(&f);
v = jl_apply(f, NULL, 0);
JL_GC_POP();
jl_exception_clear();
}
JL_CATCH {
v = NULL;
Expand All @@ -170,6 +173,7 @@ DLLEXPORT jl_value_t *jl_call1(jl_function_t *f, jl_value_t *a)
JL_GC_PUSH2(&f,&a);
v = jl_apply(f, &a, 1);
JL_GC_POP();
jl_exception_clear();
}
JL_CATCH {
v = NULL;
Expand All @@ -185,6 +189,7 @@ DLLEXPORT jl_value_t *jl_call2(jl_function_t *f, jl_value_t *a, jl_value_t *b)
jl_value_t *args[2] = {a,b};
v = jl_apply(f, args, 2);
JL_GC_POP();
jl_exception_clear();
}
JL_CATCH {
v = NULL;
Expand All @@ -200,6 +205,7 @@ DLLEXPORT jl_value_t *jl_call3(jl_function_t *f, jl_value_t *a, jl_value_t *b, j
jl_value_t *args[3] = {a,b,c};
v = jl_apply(f, args, 3);
JL_GC_POP();
jl_exception_clear();
}
JL_CATCH {
v = NULL;
Expand All @@ -223,6 +229,7 @@ DLLEXPORT jl_value_t *jl_get_field(jl_value_t *o, char *fld)
jl_value_t *s = (jl_value_t*)jl_symbol(fld);
int i = jl_field_index((jl_datatype_t*)jl_typeof(o), (jl_sym_t*)s, 1);
v = jl_get_nth_field(o, i);
jl_exception_clear();
}
JL_CATCH {
v = NULL;
Expand Down

0 comments on commit 9785017

Please sign in to comment.