Skip to content

After blueprint copy the displayed drawn name doesn't get applied #14755

@Frank995

Description

@Frank995

Environment

  • Qiskit version: 2.1.1
  • Python version: 3.12
  • Operating system: Ubuntu

What is happening?

When copying a blueprint and changing its name, the drawn circuit still uses the old name.

How can we reproduce the issue?

from qiskit.circuit.library import QFT

qft = QFT(num_qubits=1, name='foo')
print(qft.name)
print(qft.draw())
qft2 = qft.copy(name='bar')
print(qft2.name)
print(qft2.draw())

Outputs:

foo
┌─────┐
q: ┤ foo ├
└─────┘
bar
┌─────┐
q: ┤ foo ├
└─────┘

What should happen?

It should output instead:
Outputs:

foo
┌─────┐
q: ┤ foo ├
└─────┘
bar
┌─────┐
q: ┤ bar ├
└─────┘

Any suggestions?

I'm checking whether it could be a problem of _base_name not being updated in blueprint.copy method

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions