Skip to content

Commit 77fb35d

Browse files
BUG FIX: with(registerDoFuture(), local = TRUE) produced error on 'argument "expr" is missing, with no default'
1 parent 93dfae7 commit 77fb35d

File tree

6 files changed

+53
-5
lines changed

6 files changed

+53
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: doFuture
2-
Version: 1.1.1-9004
2+
Version: 1.1.1-9005
33
Title: Use Foreach to Parallelize via the Future Framework
44
Depends:
55
foreach (>= 1.5.0),

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Bug Fixes
44

5+
* `with(registerDoFuture(), local = TRUE)` produced error on
6+
'argument "expr" is missing, with no default'.
7+
58
* Environment variable `R_DOFUTURE_DEBUG` did not set R option
69
`doFuture.debug` as documented.
710

R/with.DoPar.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#' @param \ldots Not used.
1717
#'
1818
#' @returns
19-
#' Invisibly, the value of `expr`.
19+
#' Invisibly, the value of `expr` if `local = FALSE`, other NULL.
2020
#'
2121
#' @example incl/with.R
2222
#'
@@ -38,9 +38,9 @@ with.DoPar <- function(data, expr, ..., local = FALSE, envir = parent.frame()) {
3838
call <- as.call(list(undoDoPar))
3939
args <- list(call, add = TRUE, after = TRUE)
4040
do.call(base::on.exit, args = args, envir = envir)
41+
invisible(NULL)
4142
} else {
4243
on.exit(undoDoPar())
44+
invisible(eval(expr, envir = envir, enclos = baseenv()))
4345
}
44-
45-
invisible(eval(expr, envir = envir, enclos = baseenv()))
4646
}

inst/testme/test-with.DoPar.R

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#' @tags with
2+
#' @tags %dopar%
3+
#' @tags sequential multisession
4+
5+
library(doFuture)
6+
7+
foreach::registerDoSEQ()
8+
stopifnot(foreach::getDoParName() == "doSEQ")
9+
10+
with(registerDoFuture(), {
11+
stopifnot(foreach::getDoParName() == "doFuture")
12+
})
13+
stopifnot(foreach::getDoParName() == "doSEQ")
14+
15+
with(registerDoFuture("%dopar%"), {
16+
stopifnot(foreach::getDoParName() == "doFuture")
17+
})
18+
stopifnot(foreach::getDoParName() == "doSEQ")
19+
20+
with(registerDoFuture("%dofuture%"), {
21+
stopifnot(foreach::getDoParName() == "doFuture2")
22+
})
23+
stopifnot(foreach::getDoParName() == "doSEQ")
24+
25+
26+
local({
27+
with(registerDoFuture(), local = TRUE)
28+
stopifnot(foreach::getDoParName() == "doFuture")
29+
})
30+
stopifnot(foreach::getDoParName() == "doSEQ")
31+
32+
local({
33+
with(registerDoFuture("%dopar%"), local = TRUE)
34+
stopifnot(foreach::getDoParName() == "doFuture")
35+
})
36+
stopifnot(foreach::getDoParName() == "doSEQ")
37+
38+
local({
39+
with(registerDoFuture("%dofuture%"), local = TRUE)
40+
stopifnot(foreach::getDoParName() == "doFuture2")
41+
})
42+
stopifnot(foreach::getDoParName() == "doSEQ")

man/with.DoPar.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test-with.DoPar.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## This runs testme test script inst/testme/test-with.DoPar.R
2+
## Don't edit - it was autogenerated by inst/testme/deploy.R
3+
doFuture:::testme("with.DoPar")

0 commit comments

Comments
 (0)