Skip to content
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 instruction inheritance issues #1908

Merged
merged 11 commits into from
Mar 10, 2019
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ The format is based on `Keep a Changelog`_.
- **Fixed**: for any bug fixes.
- **Security**: in case of vulnerabilities.


`UNRELEASED`_
=============


Added
-----

Expand Down Expand Up @@ -87,6 +87,7 @@ Deprecated
Fixed
-----

- Fixed #1892, whereby inheriting from QuantumRegister or ClassicalRegister would cause a QiskitError in instruction.py
- Fixed #829 by removing dependence on scipy unitary_group (#1857).
- Fixed a bug with measurement sampling optimization in BasicAer
qasm_simulator (#1624).
Expand Down
4 changes: 2 additions & 2 deletions qiskit/circuit/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def __init__(self, name, params, qargs, cargs, circuit=None):
Raises:
QiskitError: when the register is not in the correct format.
"""
if not all((type(i[0]), type(i[1])) == (QuantumRegister, int) for i in qargs):
if not all(isinstance(i[0], QuantumRegister) and isinstance(i[1], int) for i in qargs):
raise QiskitError("qarg not (QuantumRegister, int) tuple")
if not all((type(i[0]), type(i[1])) == (ClassicalRegister, int) for i in cargs):
if not all(isinstance(i[0], ClassicalRegister) and isinstance(i[1], int) for i in cargs):
raise QiskitError("carg not (ClassicalRegister, int) tuple")
self.name = name
self.params = [] # a list of gate params stored
Expand Down