Skip to content

Commit ae589dc

Browse files
committed
Further R-devel driven refinement for function-in-namespace lookup
1 parent 6036853 commit ae589dc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2026-04-02 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* inst/include/Rcpp/Function.h: Further refinement for 4.6.0 to not
4+
require R_NamespaceRegistry, using R_getRegisteredNamespace() instead
5+
16
2026-04-01 Mattias Ellert <mattias.ellert@physics.uu.se>
27

38
* inst/discovery/cxx0x.R: Set execute permissions for script

inst/include/Rcpp/Function.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,14 @@ namespace Rcpp{
6969
}
7070

7171
Function_Impl(const std::string& name, const std::string& ns) {
72-
#if R_VERSION < R_Version(4,5,0)
72+
#if R_VERSION < R_Version(4,6,0)
7373
Shield<SEXP> env(Rf_findVarInFrame(R_NamespaceRegistry, Rf_install(ns.c_str())));
74+
if (env == R_UnboundValue)
75+
stop("there is no namespace called \"%s\"", ns);
7476
#else
75-
Shield<SEXP> env(R_getVarEx(Rf_install(ns.c_str()), R_NamespaceRegistry, FALSE, R_UnboundValue));
77+
Shield<SEXP> env(R_getRegisteredNamespace(ns.c_str()));
78+
if (env == R_NilValue)
79+
stop("there is no namespace called \"%s\"", ns);
7680
#endif
7781
if (env == R_UnboundValue) {
7882
stop("there is no namespace called \"%s\"", ns);

0 commit comments

Comments
 (0)