-
Notifications
You must be signed in to change notification settings - Fork 205
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
[BUG]: Can't monkeypatch __init__
with Python 3.12 and nanobind 2.2.0
#750
Comments
This wasn't supported behavior before, so I don't consider this a regression. Basically what happens is that nanobind now uses a faster code path to simultaneously execute However, there has always been an official mechanism to customize object construction by specifying the What you should be able to do is to specify a dummy |
In commit bbbd022, I added a test that demonstrates how to do this. (No functionality changes in nanobind, this is just to show you and make sure that it keeps on working). |
Thank you for the demonstration! Even so, we'll simply move the relevant constructors to C++. inducer/pyopencl#791 |
Problem description
It seems that starting from nanobind 2.2.0, monkeypatching a C++ class'
__init__
method with a Python function is silently ignored. This happens only in Python 3.12, not (e.g.) in 3.11.I have bisected this to #701.
Reproducible example code
t.py
:my_ext.cpp
:Output on Python 3.12 with nanobind 2.2.0:
Output on Python 3.11 or (Python 3.12 with nanobind 2.1.0):
cc inducer/pyopencl#789 @inducer
The text was updated successfully, but these errors were encountered: