-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: Python-3.12 compatibility #4168
Conversation
a8ba9e1
to
b7cfbcc
Compare
b7cfbcc
to
6741b67
Compare
Hi level questions, these may be naive or infeasible:
|
I believe python method resolution rules leave no alternative to dynamics attributes to correctly implement the There are more troubles for The feature freeze for Python 3.12 should be around May 2023, so I believe it can be undone or done differently. Another possible solution would be to avoid subclassing built-in I read through the lined issues/PR, and I believe this issue is not related to WRT CI, I think someone just adds more images to the list once a new python version gets released. I think having an opportunity to test against an upstream python version is a nice feature. Although such CI builds will not be reproducible and prone to spurious errors due to rapid changes in CPython. |
First thought: it doesn't seem attractive, because it sounds like complex functionality is duplicated, with small tweaks. Is that a fair way to look at it? — If yes, we'll have the potential for divergence over time, with all the confusion that usually arises from such a situation.
Thanks for the explanation!
Yeah, we'd need some way to easily pin on a CPython commit, but that's probably easy to achieve. (I'm itching to try ... but someone must have done something similar already ...) Coming back to this PR, it's tiny, and if it helps testing with pybind11 while 3.12 is still fluid, I think we should merge, but maybe with a special comment? E.g. |
I totally agree, re-implementing the I tried a no-brainer python build from source on CI, but it failed at pybind linking stage. You are right, pinning a version is not a problem. I'll submit a PR if I squeeze something meaningful out of it. |
JIC you find this useful: https://github.com/rwgk/pybind11_scons/blob/8c15a4c54a010beb650084c801a5c48464e930b7/SConscript#L155 (That small SConscript has pretty much all tricks required in one easy view, but Linux only.) |
I forgot to mention, I find |
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.
@henryiii @Skylion007 Do you want to take a look?
No response from @henryiii @Skylion007 for 9 days, I assume this PR is fine with them. In the meantime 311rc2 was released. I will try to:
Hang on. |
Enable dynamic attributes for `pybind11_static_property`
896d4ba
to
019bc66
Compare
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.
Looks okay if tests pass.
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.
Fine by me if it passes 3.12 tests.
Thanks! |
I can confirm that this fixes the problem for me. |
We'll try to get a release out in the "near" future. "Near" is a fluid term, though. |
Ah, for future reference it's python/cpython#23205 |
Enable dynamic attributes for
pybind11_static_property
for compatility with cpython-3.12Description
The problem is that
property
-derived classes now use__doc__
attribute, which in turn requires to enable "dynamic attributes". All that seems like a pessimisation which is not welcome here. I'm submitting the PR to demonstrate a possible solution if the compatibility issue will be solved on pybind side.Sorry for all the trouble. I thought I'd been fixing
cpython
, not breakingpybind
. 😞Suggested changelog entry:
Enable dynamic attributes for `pybind11_static_property` for Python-3.12
Closes #4115