Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: setDoSeq() attempts to remove the incorrect variables on error #25

Open
HenrikBengtsson opened this issue Dec 28, 2020 · 1 comment · May be fixed by #26
Open

BUG: setDoSeq() attempts to remove the incorrect variables on error #25

HenrikBengtsson opened this issue Dec 28, 2020 · 1 comment · May be fixed by #26

Comments

@HenrikBengtsson
Copy link

Analogously, to setDoPar(), the setDoSeq() function attempts to undo partially set variables in case there's an error;

foreach/R/setDoSeq.R

Lines 31 to 47 in 731cff6

setDoSeq <- function(fun, data=NULL, info=function(data, item) NULL) {
tryCatch(
{
assign('seqFun', fun, pos=.foreachGlobals, inherits=FALSE)
assign('seqData', data, pos=.foreachGlobals, inherits=FALSE)
assign('seqInfo', info, pos=.foreachGlobals, inherits=FALSE)
}, error = function(e) {
if (exists('fun', where=.foreachGlobals, inherits=FALSE))
remove('fun', envir = .foreachGlobals)
if (exists('data', where=.foreachGlobals, inherits=FALSE))
remove('data', envir = .foreachGlobals)
if (exists('info', where=.foreachGlobals, inherits=FALSE))
remove('info', envir = .foreachGlobals)
e
})
}

However, due to what looks like a cut'n'paste mistake from setDoPar(), setDoSeq() removes the wrong variables.

@HenrikBengtsson
Copy link
Author

HenrikBengtsson commented Dec 28, 2020

PR #26 fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant