Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a followup to #1552 (and to a smaller extent, #1558 and #1560).
This standardizes the approach across
py_{has,get,set,del}_{attr,item}
to consistently initialize Python and resolve module proxies as needed.The following functions will resolve delayed module proxies (and initialize Python). These are unchanged from the previous CRAN release:
py_get_item()
py_set_item()
py_del_item()
py_has_attr()
py_get_attr()
py_set_attr()
py_del_attr()
py_list_attributes()
With this patch,
py_validate_xptr()
will now also resolve module proxies (previously it would error).The following functions do not resolve module proxies or initialize Python:
py_is_null_xptr()
(returnsTRUE
for module proxies)print()
andstr()
(printing a lazy module does not resolve it or initialize python).This also fixes two additional minor issue:
<pointer: 0x0>
.py_get_item(silent = TRUE)
now clears any set exceptions, instead of restoring the previous exception state (to avoid a repeat of CallPyErr_Clear()
instead ofPyErr_Restore()
inpy_get_attr_impl(silent = TRUE)
#1560)