-
Notifications
You must be signed in to change notification settings - Fork 329
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
Updates for Python 3.13 #1686
Merged
Merged
Updates for Python 3.13 #1686
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 3.13 introduces new stable API C symbols: - PyObject_HasAttrStringWithError - PyObject_GetOptionalAttrString Under normal circumstances we would continue to use the previous API, but unfortunalty, other changes force our hand. The previous PyObject_HasAttrString now issues unsilencable warning to stderr evertime the returned value is 0. So we can no longer use PyObject_HasAttrString without leaking verbose unactionable output to user's consoles.
t-kalinowski
force-pushed
the
python-3-13-compat
branch
from
October 28, 2024 14:10
77e4827
to
bedd785
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For Reticulate internals, Python 3.13 introduces two significant changes:
PyObject_HasAttrString()
now emits a non-suppressible warning to stderr when it returns a false value:To prevent this output from repeatedly appearing in user consoles, Reticulate internals have been refactored to use the new C entry points introduced in Python 3.13:
PyObject_HasAttrStringWithError
andPyObject_GetOptionalAttrString
, with backports implemented in reticulate for older Python versions.Quoting from the Python 3.13 release notes:
This change affects how the S3 class attribute vector is determined when presenting a Python object at the R level. Specifically, Python classes using metaclasses where
__module__
or__name__
is aproperty
can no longer resolve correctly. This issue is encountered in objects subclassingwrapt.ProxyObject
and likely other classes using a similar pattern. Consequently, internal updates toget_r_class()
in Reticulate were needed, and the S3 class of such objects has now changed.