Repository navigation
fix: raise ValidationError for empty OpenQASM loads() - #451
tonycoder-hub wants to merge 1 commit into
Conversation
Argus reviewAuto-review is off for this repo. Tick the box below to run a review on this PR.
Estimated cost
Tip: you can also comment |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
62f9ee5 to
8292778
Compare
|
Hi @tonycoder-hub , thanks for fixing this! The changes lgtm. Can you please fix the format job in CI and add a |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
8292778 to
cb1d0d5
Compare
openqasm3.parse raises AttributeError (not QASM3ParsingError) for empty or whitespace-only input when an internal span is None. Catch that and map it to ValidationError like other parse failures. Signed-off-by: Tony Coder <407243179@qq.com>
cb1d0d5 to
89b0e5e
Compare
|
Thanks @TheGupta2012 — format (trailing newlines) is fixed and I've added a |
Summary of changes
openqasm3.parse("")(and whitespace-only input) raisesAttributeError('NoneType' object has no attribute 'line') instead ofQASM3ParsingError.pyqasm.loads()only caughtQASM3ParsingError, so empty strings bubbled up as an unexpectedAttributeError.This PR also catches
AttributeErrorfromopenqasm3.parseand maps it toValidationError, matching other unparseable-string failures. Header-only programs (OPENQASM 3.0;\n) still load successfully.Fixes #437