-
-
Notifications
You must be signed in to change notification settings - Fork 220
Fix R_UnboundValue NOTE #1466
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
base: master
Are you sure you want to change the base?
Fix R_UnboundValue NOTE #1466
Changes from all commits
44e6a1a
ebf1f89
e904602
d6b08fc
505eb9c
3f35dbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,11 @@ | ||
| 2026-03-29 Iñaki Ucar <[email protected]> | ||
|
|
||
| * inst/include/Rcpp/api/meat/Rcpp_eval.h: Remove check for non-API | ||
| R_UnboundValue, which is never returned anyway from Rf_findFun | ||
| * inst/include/Rcpp/Function.h: Use alternative to R_UnboundValue | ||
| * inst/include/Rcpp/Promise.h: Idem | ||
| * inst/include/Rcpp/Environment.h: Idem + some refactoring | ||
|
|
||
| 2026-03-26 Dirk Eddelbuettel <[email protected]> | ||
|
|
||
| * inst/bib/Rcpp.bib: Refreshed a few more references | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,8 @@ | |
| // | ||
| // Promise.h: Rcpp R/C++ interface class library -- promises (PROMSXP) | ||
| // | ||
| // Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois | ||
| // Copyright (C) 2010 - 2025 Dirk Eddelbuettel and Romain François | ||
| // Copyright (C) 2026 Dirk Eddelbuettel, Romain François and Iñaki Ucar | ||
| // | ||
| // This file is part of Rcpp. | ||
| // | ||
|
|
@@ -48,13 +49,18 @@ namespace Rcpp{ | |
| * Return the result of the PRVALUE macro on the promise | ||
| */ | ||
| SEXP value() const{ | ||
| SEXP val = PRVALUE( Storage::get__() ) ; | ||
| if( val == R_UnboundValue ) throw unevaluated_promise() ; | ||
| return val ; | ||
| if (!was_evaluated()) throw unevaluated_promise(); | ||
| return PRVALUE(Storage::get__()); | ||
| } | ||
|
|
||
| bool was_evaluated() const { | ||
| #if R_VERSION < R_Version(4,6,0) | ||
| return PRVALUE(Storage::get__()) != R_UnboundValue ; | ||
| #else | ||
| SEXP env = environment(); | ||
| R_BindingType_t bt = R_GetBindingType(Storage::get__(), env); | ||
| return bt != R_BindingTypeUnbound; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, and legit per WRE's r-devel version |
||
| #endif | ||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // Copyright (C) 2013 - 2025 Romain Francois | ||
| // Copyright (C) 2026 Romain Francois and Dirk Eddelbuettel | ||
| // Copyright (C) 2026 Romain Francois, Dirk Eddelbuettel and Iñaki Ucar | ||
| // | ||
| // This file is part of Rcpp. | ||
| // | ||
|
|
@@ -56,10 +56,6 @@ inline SEXP Rcpp_eval(SEXP expr, SEXP env) { | |
| // 'identity' function used to capture errors, interrupts | ||
| Shield<SEXP> identity(Rf_findFun(::Rf_install("identity"), R_BaseNamespace)); | ||
|
|
||
| if (identity == R_UnboundValue) { | ||
| stop("Failed to find 'base::identity()'"); | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for kicks: when/why did we need this? When could that have been true?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. git-blame says that this is from 20 years ago, and Rcpp is 18 years old, so... never.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it says @kevinushey did this in 2015: (i.e. I was asking why we added this / why we can now simply remove it). |
||
| // define the evalq call -- the actual R evaluation we want to execute | ||
| Shield<SEXP> evalqCall(Rf_lang3(::Rf_install("evalq"), expr, env)); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That simplification seems almost too good to be true. Why did we not do that earlier? 😆