Skip to content

Commit 194ef2b

Browse files
committed
added nocov for R 3.4/5 fix and TODO
1 parent af7736d commit 194ef2b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

R/print.data.table.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,25 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
3232
# Other options investigated (could revisit): Cstack_info(), .Last.value gets set first before autoprint, history(), sys.status(),
3333
# topenv(), inspecting next statement in caller, using clock() at C level to timeout suppression after some number of cycles
3434
SYS = sys.calls()
35+
36+
# TODO(R>=3.6): Remove this branch once the minimal supported R version is raised. No need for is_print_call. Just
37+
# identical(SYS[[1L]][[1L]], print)
38+
3539
# is_print_call detects whether print() was called either explicitly or through autoprint,
3640
# is wrapped in a promise or not to account for R 3.4/3.5.
3741
is_print_call = FALSE
3842
if (identical(SYS[[1L]][[1L]], print)) {
3943
is_print_call = TRUE
40-
} else if (typeof(SYS[[1L]][[1L]]) == "promise") {
44+
}
45+
# nocov start
46+
else if (typeof(SYS[[1L]][[1L]]) == "promise") {
4147
# in R 3.4 and R 3.5, auto-print uses a promise to reference base::print due to lazy loading
4248
# safely evaluate promise to get the actual function
4349
evaluated = tryCatch(eval(SYS[[1L]][[1L]]), error = function(e) NULL)
4450
if (identical(evaluated, print)) {
4551
is_print_call = TRUE
4652
}
47-
}
53+
} # nocov end
4854
if (is_print_call || # this is what auto-print looks like, i.e. '> DT' and '> DT[, a:=b]' in the terminal; see #3029.
4955
( length(SYS) >= 3L && is.symbol(thisSYS <- SYS[[length(SYS)-2L]][[1L]]) &&
5056
as.character(thisSYS) == 'source') ) { # suppress printing from source(echo = TRUE) calls, #2369

0 commit comments

Comments
 (0)