Or rather this version without a typo:
SEXP cppExceptExpr = PROTECT(Rf_lang3(cppExceptSym,
Rf_mkString(exception_what.c_str()),
Rf_mkString(exception_class.c_str())));
Rf_eval(cppExceptExpr, R_FindNamespace(Rf_mkString("Rcpp"))); // Should
not return.
// Do this in case somehow someone replaces the definition of
// "cpp_exception" such that it does return:
UNPROTECT(1);
It passes checks here, but so did the previous versions -- and when I do a
simple test with gctorture() :
library(inline)
f <- rcpp(signature(aa="ANY"), body='Rcpp::NumericVector a(aa); return a;')
gctorture(TRUE)
print(f(1:4))
f(LETTERS[1:4]) # will trigger exception
I get this before the patch
edd@max:~$ R --slave -e 'source("/tmp/tryEx.r")'
[1] 1 2 3 4
Error in f(LETTERS[1:4]) : /usr/local/lib/R/site-library/Rcpp/R/Rcpp.rdb
Calls: source ... withVisible -> eval -> eval -> f -> <Anonymous> ->
<Anonymous>
Execution halted
edd@max:~$
which seems like what you described where as after installing Rcpp with the
change above, we get
edd@max:~/svn/rcpp/pkg$ R --slave -e 'source("/tmp/tryEx.r")'
[1] 1 2 3 4
Error in f(LETTERS[1:4]) : not compatible with REALSXP
Calls: source ... withVisible -> eval -> eval -> f -> <Anonymous> ->
cpp_exception
Execution halted
edd@max:~/svn/rcpp/pkg$
which is what we get without gctorture() -- so the PROTECT seems to help.
Dirk
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel