MS gate validation error handling
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
The traceback points to the loop in the validation code that calls gate_function(*targets) near line 666, and to ms_gate(), which fails on a missing qubit1 argument. Run the two-argument ms(0, 0.5) q[0], q[1]; snippet from the issue, then check the argument count against the gate's signature before the call so it raises a ValidationError naming the missing third parameter. Done when module.validate() raises that error for the snippet and the existing tests still pass.
Written by the indexing model from the issue text.
Description
This issue is very similar in nature to https://github.com/qBraid/pyqasm/issues/109, and is indirectly related to https://github.com/qBraid/pyqasm/issues/113.
The ms currently requires 3 parameters. If you instead provide it 2 parameters, there is an uncaught TypeError:
import pyqasm
qasm = """
OPENQASM 2;
include "qelib1.inc";
qreg q[2];
ms(0, 0.5) q[0], q[1];
"""
module = pyqasm.loads(qasm)
module.validate()
...
[665] for targets in all_targets:
--> [666] result.extend(gate_function(*targets))
[667] return result
TypeError: ms_gate() missing 1 required positional argument: 'qubit1'
Instead, it should raise a ValidationError and tell you that the third parameter is missing.
- Dominant language
- Python
- Stars
- 29
- Forks
- 33
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from qBraid/pyqasm
-
dumps() prints the original program when unroll() leaves at most one statementPossibly taken @ShiveshDragon claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
qBraid/pyqasm#493 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 43/100
Maintainers usually reply within 1 day
-
dependencies enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Integer division for casts, int array elements, bitwise results, ** and int-returning subroutinesOpen
Difficulty 3/5 1-2 days Newbie friendliness 52/100
qBraid/pyqasm#480 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
backend bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
nolte/kamerplanter#3193 ·
Maintainers usually reply within 1 day
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day