Skip to content

Commit 5a890d3

Browse files
Simplify globals assignment => drop support for tricky recursive globals
1 parent e0285d3 commit 5a890d3

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

R/expressions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ evalFuture <- function(
452452
names <- names(globals)
453453
envs <- list()
454454
oldEnvs <- list()
455-
env <- envir
455+
env <- globalenv()
456456
repeat {
457457
if (identical(env, emptyenv())) break
458458
if (isNamespace(env)) {

R/globals.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ getGlobalsAndPackages <- function(expr, envir = parent.frame(), tweak = tweakExp
223223
}
224224
globals <- globals[-idxs[!keep]]
225225
if (debug) {
226+
names <- names(globals)
226227
idxs <- which(names == "future.call.arguments")
227228
mdebugf("- 'future.call.arguments' global entries:")
228229
mstr(globals[idxs])

tests/globals,tricky_recursive.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ for (strategy in supportedStrategies()) {
7070
str(list(x2 = x2))
7171
stopifnot(identical(x2, x0))
7272

73-
y <- main_futureCall()
74-
str(list(y = y))
75-
if (is.null(y0)) y0 <- y
76-
stopifnot(identical(y, y0))
77-
78-
y2 <- main_futureCall_no_FUN()
79-
str(list(y2 = y2))
80-
stopifnot(identical(y2, y0))
73+
# y <- main_futureCall()
74+
# str(list(y = y))
75+
# if (is.null(y0)) y0 <- y
76+
# stopifnot(identical(y, y0))
77+
78+
# y2 <- main_futureCall_no_FUN()
79+
# str(list(y2 = y2))
80+
# stopifnot(identical(y2, y0))
8181

8282
z <- main_lapply()
8383
str(list(z = z))

0 commit comments

Comments
 (0)