-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[R-package] Convert LGBM_GetLastError_R to use R built-in types #4242
Conversation
Ok CI seems to be happy, so I've converted this to "ready for review". |
/gha run r-valgrind Workflow R valgrind tests has been triggered! 🚀 Status: failure ❌. |
/gha run r-valgrind Workflow R valgrind tests has been triggered! 🚀 Status: success ✔️. |
/gha run r-solaris Workflow Solaris CRAN check has been triggered! 🚀 solaris-x86-patched: https://builder.r-hub.io/status/lightgbm_3.2.1.99.tar.gz-c0715a2abb824fce9279615c6eee11be |
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.
Very nice simplification!
out = PROTECT(Rf_allocVector(STRSXP, 1)); | ||
SET_STRING_ELT(out, 0, Rf_mkChar(LGBM_GetLastError())); |
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.
Just a question: what is the difference between Rf_allocVector
/allocVector
and Rf_mkChar
/mkChar
?
I could find only the following link: https://www.cs.kent.ac.uk/projects/cxxr/doc/html/Rinternals_8h.html. And it looks like they are just aliases...
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.
yep, just aliases! This #define
says "use the symbols with the Rf_
prefix"
LightGBM/R-package/src/lightgbm_R.cpp
Line 15 in 1a367c6
#define R_NO_REMAP |
I like that because it makes it a little more obvious which symbols are coming from R's headers.
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
This is a small step towards #3016. This PR proposes converting
LGBM_GetLastError_R
(and the R function that calls it,lgb.last_error()
) to use R's built-in types instead of the custom type defined in https://github.com/microsoft/LightGBM/blob/91f72e2a8c8b1e5433d30d3891923b3a067402a6/R-package/src/R_object_helper.h.Notes for Reviewers
This PR is not dependent on #4155.#4155 has been merged tomaster
and this PR has been updated with it.You can see the following to learn about the
SEXP
type.