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
12 changes: 11 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ The format is based on `Keep a Changelog`_.
- **Fixed**: for any bug fixes.
- **Security**: in case of vulnerabilities.


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


`0.7.2`_ - 2019-03-05
=====================
Woody1193 marked this conversation as resolved.
Show resolved Hide resolved


Fixed
-----

- Fixed a bug whereby inheriting from QuantumRegister or ClassicalRegister
would cause a QiskitError in instruction.py
Woody1193 marked this conversation as resolved.
Show resolved Hide resolved

Added
-----

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