Skip to content

Commit

Permalink
Fix instruction inheritance issues (#1908)
Browse files Browse the repository at this point in the history
* fix BasicAer sampling bug (#1624) (#1859)

* fix BasicAer sampling bug (#1624)

* fix BasicAer sampling bug

* changelog

* remove legacysimulator from test_compile

Conflicts:
    CHANGELOG.rst
    test/python/tools/test_compiler.py

The changelog conflicts were inevitable as the stable branch doesn't
have the same history as master. As for the test conflict it was a
difference in the simulator (python vs c++) used, this backport
switches to use the python like on master.

(cherry picked from commit 5f7b2e7)

* Try pinning isort version

* Use constraints from last working version of lint

* Add requirements constraints too

* Bump version and prepare for 0.7.1 release (#1886)

* Bump version and prepare for 0.7.1 release

To prepare for the 0.7.1 bugfix release we need to increase the version
number and update the changelog. This commit takes care of that so we
can tag the release and build it.

* Addressed issue with instruction.py which prohibited inheritance of QuantumRegisters and ClassicalRegisters

* Updated changelog

* Fixed typo

* Reverted changes from merge with Stable

* Fixed changelog
  • Loading branch information
Woody1193 authored and ajavadia committed Mar 10, 2019
1 parent 79d91f6 commit a70d532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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

0 comments on commit a70d532

Please sign in to comment.