Skip to content

Commit

Permalink
Fix premature session closure error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tak Hur authored and Tak Hur committed Dec 9, 2024
1 parent 40a4d24 commit bb786b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pennylane_qiskit/qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ def execute_circuits(session):
results.append(execute_fn(circ, session))
yield results
finally:
session.close()
if self._session is None:
session.close()

with execute_circuits(session) as results:
return results
Expand Down

0 comments on commit bb786b8

Please sign in to comment.