From be16f4d3450426edaffcc46e5b01b674bae5258a Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 8 Aug 2024 08:46:36 +0200 Subject: [PATCH 1/3] get corret topenv() for crate() --- R/crate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/crate.R b/R/crate.R index aaf9cddc..eaae3c5f 100644 --- a/R/crate.R +++ b/R/crate.R @@ -28,7 +28,7 @@ #' z = 300 #' f = meta_f(1) #' f() -crate = function(.fn, ..., .parent = topenv(), .compile = TRUE) { +crate = function(.fn, ..., .parent = topenv(parent.frame()), .compile = TRUE) { assert_flag(.compile) .compile = .compile || is_compiled(.fn) nn = map_chr(substitute(list(...)), as.character)[-1L] From 85e62ede9e97336feb3950af18256b81cb2262ac Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 8 Aug 2024 08:53:39 +0200 Subject: [PATCH 2/3] Update NEWS.md --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index af4b500b..07e22e89 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # mlr3misc (development version) +* Bugfix: `crate()` is using the correct 'topenv' environment now. + # mlr3misc 0.15.1 * refactor: Update `as_callback()` functions. From 2d94a16c265d11c6df3cf9361025a2c478cbce42 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 8 Aug 2024 08:54:26 +0200 Subject: [PATCH 3/3] document() --- DESCRIPTION | 2 +- man/crate.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a5f6bdc8..7671c591 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,7 +34,7 @@ Config/testthat/parallel: true Encoding: UTF-8 NeedsCompilation: yes Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Collate: 'Dictionary.R' 'named_list.R' diff --git a/man/crate.Rd b/man/crate.Rd index a84039ff..c8699d41 100644 --- a/man/crate.Rd +++ b/man/crate.Rd @@ -4,7 +4,7 @@ \alias{crate} \title{Isolate a Function from its Environment} \usage{ -crate(.fn, ..., .parent = topenv(), .compile = TRUE) +crate(.fn, ..., .parent = topenv(parent.frame()), .compile = TRUE) } \arguments{ \item{.fn}{(\verb{function()})\cr