Skip to content

Commit

Permalink
Fix instruction inheritance issues (Qiskit#1900)
Browse files Browse the repository at this point in the history
* Addressed issue with instruction.py which prohibited inheritance of QuantumRegisters and ClassicalRegisters

* Updated changelog

* Fixed typo
  • Loading branch information
Woody1193 authored and ajavadia committed Mar 6, 2019
1 parent d5791fa commit 36d5d5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ The format is based on `Keep a Changelog`_.
`UNRELEASED`_
=============


`0.7.2`_ - 2019-03-05
=====================


Fixed
-----

- Fixed a bug whereby inheriting from QuantumRegister or ClassicalRegister
would cause a QiskitError in instruction.py

`0.7.1`_ - 2019-03-04
=====================

Expand Down
4 changes: 2 additions & 2 deletions qiskit/circuit/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def __init__(self, name, param, 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.param = [] # a list of gate params stored as sympy objects
Expand Down

0 comments on commit 36d5d5d

Please sign in to comment.