Skip to content

Commit

Permalink
Depend on Rcpp 0.12.17.3 so that we can benefit from RcppCore/Rcpp#868
Browse files Browse the repository at this point in the history
…and remove the calls from Rcpp exceptions. closes #3662
  • Loading branch information
romainfrancois committed Aug 6, 2018
1 parent 9584596 commit f159817
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Imports:
methods,
pkgconfig (>= 2.0.1),
R6 (>= 2.2.2),
Rcpp (>= 0.12.15),
Rcpp (>= 0.12.17.3),
rlang (>= 0.2.0.9001),
tibble (>= 1.3.1),
tidyselect (>= 0.2.3),
Expand Down Expand Up @@ -63,3 +63,4 @@ Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", "collate"))
RoxygenNote: 6.0.1.9000
Remotes:
tidyverse/rlang
RcppCore/Rcpp
4 changes: 4 additions & 0 deletions inst/include/dplyr_RcppExports.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace dplyr {
}
if (rcpp_result_gen.inherits("interrupted-error"))
throw Rcpp::internal::InterruptedException();
if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
throw Rcpp::internal::LongjumpException(rcpp_result_gen);
if (rcpp_result_gen.inherits("try-error"))
throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
return Rcpp::as<SEXP >(rcpp_result_gen);
Expand All @@ -58,6 +60,8 @@ namespace dplyr {
}
if (rcpp_result_gen.inherits("interrupted-error"))
throw Rcpp::internal::InterruptedException();
if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
throw Rcpp::internal::LongjumpException(rcpp_result_gen);
if (rcpp_result_gen.inherits("try-error"))
throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
return Rcpp::as<SEXP >(rcpp_result_gen);
Expand Down
2 changes: 1 addition & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Disable long types from C99 or CPP11 extensions
PKG_CPPFLAGS = -I../inst/include -DCOMPILING_DPLYR -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -DRCPP_USING_UTF8_ERROR_STRING
PKG_CPPFLAGS = -I../inst/include -DRCPP_DEFAULT_INCLUDE_CALL=false -DCOMPILING_DPLYR -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -DRCPP_USING_UTF8_ERROR_STRING
2 changes: 1 addition & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PKG_CPPFLAGS = -I../inst/include -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING
PKG_CPPFLAGS = -I../inst/include -DRCPP_DEFAULT_INCLUDE_CALL=false -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING
8 changes: 8 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ RcppExport SEXP _dplyr_get_date_classes() {
UNPROTECT(1);
Rf_onintr();
}
bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
if (rcpp_isLongjump_gen) {
Rcpp::internal::resumeJump(rcpp_result_gen);
}
Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
if (rcpp_isError_gen) {
SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
Expand Down Expand Up @@ -309,6 +313,10 @@ RcppExport SEXP _dplyr_get_time_classes() {
UNPROTECT(1);
Rf_onintr();
}
bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
if (rcpp_isLongjump_gen) {
Rcpp::internal::resumeJump(rcpp_result_gen);
}
Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
if (rcpp_isError_gen) {
SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
Expand Down
18 changes: 18 additions & 0 deletions tests/testthat/test-mutate.r
Original file line number Diff line number Diff line change
Expand Up @@ -820,3 +820,21 @@ test_that("grouped subsets are not lazy (#3360)", {

expect_identical(res, list(make_call("a"), make_call("b")))
})

test_that("errors don't have tracebacks (#3662)", {
tryCatch(
mutate(tibble(x=1:10) %>% mutate(z=y)),
error = function(e){
expect_match(conditionMessage(e), "object 'y' not found")
expect_null(conditionCall(e))
}
)

tryCatch(
n_distinct(),
error = function(e){
expect_equal(conditionMessage(e), "Need at least one column for `n_distinct()`")
expect_null(conditionCall(e))
}
)
})

0 comments on commit f159817

Please sign in to comment.