Skip to content
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

Resolve Module Proxies #1561

Merged
merged 10 commits into from Mar 27, 2024
Merged

Resolve Module Proxies #1561

merged 10 commits into from Mar 27, 2024

Conversation

t-kalinowski
Copy link
Member

@t-kalinowski t-kalinowski commented Mar 27, 2024

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() (returns TRUE for module proxies)
  • print() and str() (printing a lazy module does not resolve it or initialize python).

This also fixes two additional minor issue:

@t-kalinowski t-kalinowski changed the title try resolve module proxies in py_validate_xptr() Resolve Module Proxies Mar 27, 2024
`PyObject_HasAttr` calls `PyObject_GetAttr`. Avoid calling `__getattr__` twice.
@t-kalinowski t-kalinowski merged commit 6213e65 into main Mar 27, 2024
14 checks passed
@t-kalinowski t-kalinowski deleted the fix-module-proxies branch March 27, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant