Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Types of changes:
### Removed

### Fixed
- Fixed `loads("")` raising `AttributeError` instead of `ValidationError` for empty string input. ([#445](https://github.com/qBraid/pyqasm/pull/445))
- Fixed qubit register ranges dropping their final qubit during unrolling. Endpoints are now inclusive for gates, aliases, barriers, and measurements. Code using an exclusive upper bound must lower it by one, for example `q[0:1]` instead of `q[0:2]` to select two qubits. ([#432](https://github.com/qBraid/pyqasm/issues/432))
- Fixed `cs` and `csdg` from `stdgates.inc` being rejected during unrolling. They now decompose to controlled phase shifts. ([#439](https://github.com/qBraid/pyqasm/issues/439))
- Fixed Clifford+T rebasing for exact `rx`, `ry`, and `rz` rotations at multiples of π/4. These gates now decompose instead of disappearing, while angles outside the exact basis raise `RebaseError` instead of producing an incorrect result. ([#428](https://github.com/qBraid/pyqasm/issues/428))
Expand Down
2 changes: 2 additions & 0 deletions src/pyqasm/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ def loads(program: openqasm3.ast.Program | str, **kwargs) -> QasmModule:
program = openqasm3.parse(program)
except openqasm3.parser.QASM3ParsingError as err:
raise ValidationError(f"Failed to parse OpenQASM string: {err}") from err
except AttributeError as err:
raise ValidationError(f"Failed to parse OpenQASM string: {err}") from err
elif not isinstance(program, openqasm3.ast.Program):
raise TypeError("Input quantum program must be of type 'str' or 'openqasm3.ast.Program'.")
elif include_dir is not None:
Expand Down
7 changes: 3 additions & 4 deletions src/pyqasm/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2710,11 +2710,10 @@ def _visit_function_call(
if isinstance(subroutine_def, qasm3_ast.ExternDeclaration):
self._in_extern_function = True
global_scope = self._scope_manager.get_global_scope()
result.append(
PulseValidator.validate_and_process_extern_function_call(
statement, global_scope, self._module._device_cycle_time
)
extern_call = PulseValidator.validate_and_process_extern_function_call(
statement, global_scope, self._module._device_cycle_time
)
result.append(qasm3_ast.ExpressionStatement(expression=extern_call))
else:
for function_op in subroutine_def.body:
if isinstance(function_op, qasm3_ast.ReturnStatement):
Expand Down
Loading