R Under development (unstable) (2023-10-20 r85375) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > #### STRICT test suite in the spirit of no-segfaults, > #### but with explicit statements. > > tools::assertError(options(catch.script.errors = NA)) # TRUE or FALSE > options(catch.script.errors = TRUE) > stop("test of 'options(catch.script.errors = TRUE)'") Error: test of 'options(catch.script.errors = TRUE)' > > if(FALSE) { + ## these ought to work on machines with enough memory + ## These segfaulted in 1.3.x , give "could not allocate" errors now + integer(2^30+1) + double(2^30+1) + complex(2^30+1) + character(2^30+1) + vector("list", 2^30+2) + } > > ## bad infinite recursion / on.exit / ... interactions > ## catch the error to permit different error messages emitted > ## (handling of infinite recursion is different in the AST interpreter > ## and the byte-code interpreter) > > bar <- function() 1+1 > foo <- function() { on.exit(bar()); foo() } > tryCatch(foo(), error=function(x) TRUE) # now simple "infinite recursion" [1] TRUE >