-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
The unused parameter dag
in DAGNode
constructor is deprecated
#13862
Conversation
One or more of the following people are relevant to this code:
|
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.
I'm pretty sure this approach won't work. It changes the semantics around the DAG node types and will break a lot of the usage around the classes. It should be pretty easy to emit the deprecation warning from rust though, here is an example of calling python's warning from rust:
qiskit/crates/circuit/src/dag_circuit.rs
Lines 407 to 419 in 581dd3d
fn get_duration(&self, py: Python) -> PyResult<Option<Py<PyAny>>> { | |
imports::WARNINGS_WARN.get_bound(py).call1(( | |
intern!( | |
py, | |
concat!( | |
"The property ``qiskit.dagcircuit.dagcircuit.DAGCircuit.duration`` is ", | |
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 2.0.0.", | |
) | |
), | |
py.get_type::<PyDeprecationWarning>(), | |
2, | |
))?; | |
Ok(self.duration.as_ref().map(|x| x.clone_ref(py))) |
We can just wrap that in an if dag.is_some()
for the dag node constructor and that should cover it.
I saw your message about raising from rust too late and I implemented in python overwriting |
One or more of the following people are relevant to this code:
|
I think we should probably add it in rust. It's a lot simpler and less error prone.. |
done in b6426fc . Easier than expected and much more correct. Thanks for the rusty push :) |
One or more of the following people are relevant to this code:
|
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.
LGTM!
Summary
Fixes #13022
Details and comments
Because
qiskit._accelerate.circuit.DAGNode
(and family) are rust implementations, I had to write a custom decorator wrapper for them.