`extern port` / `extern frame` in `cal` blocks fail to parse, blocking nearly every spec OpenPulse example
メンテナーはふだん 1 日以内に返信
@Riiocodee がすでに取り組んでいます。
2026年10月19日 から。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
Start in src/pyqasm/pulse/, where cal bodies go to openpulse.parser.parse_openpulse, and reproduce the extern port d0; failure with the openpulse parse call from the issue. The workaround in src/pyqasm/pulse/frame.py and the openpulse>=1.0.1 pin in the pulse extra of pyproject.toml need a maintainer decision first. Done means the surfaced error names the upstream limitation and the spec examples are added as xfail fixtures.
索引モデルが issue の本文から書いたものです。
説明
Limitation
The OpenPulse chapter declares ports and frames provided by
the backend with extern:
extern port d0;
extern frame d0f;
This is the standard idiom — the Ports and
Frames sections use it, and so does essentially every
worked example in the chapter, along with
Calibrations in practice.
Every one of them fails in pyqasm.
Example QASM failure
OPENQASM 3.0;
defcalgrammar "openpulse";
cal {
extern port d0;
frame d0f = newframe(d0, 5.0e9, 0.0);
}
ValidationError: Failed to parse OpenPulse string: Unexpected token 'port' at line 4, column 11.
OPENQASM 3.0;
defcalgrammar "openpulse";
cal { extern frame m0f; }
defcal measure $0 -> bit {
return capture_v2(m0f, 2048ns);
}
// ValidationError: Failed to parse OpenPulse string: Unexpected token 'frame' at line 3, column 8.
Without extern, the same declarations parse:
cal {
port d0; // OK
frame f = newframe(d0, 5.0e9, 0.0); // OK
}
Root cause — upstream
This is not a defect in pyqasm's own code. The openpulse 1.0.1 parser rejects it
directly:
>>> from openpulse import parse
>>> parse('OPENQASM 3.0;\ncal {\n extern port d0;\n}\n')
openpulse.parser.OpenPulseParsingError: Unexpected token 'port' at line 2, column 10.
>>> parse('OPENQASM 3.0;\ncal {\n extern frame d0f;\n}\n')
openpulse.parser.OpenPulseParsingError: Unexpected token 'frame' at line 2, column 10.
The externDeclaration production accepts only classical types as parameters, so the
port / frame keywords are unexpected there.
Filing it here because the user-visible effect is that pyqasm cannot analyse the spec's pulse
examples, and because the fix needs tracking and a version bound on our side.
Change Requested
- Open an issue on
openqasm/openqasmagainst the
openpulsePython package, with the reproducer above, and link it back here. - Once fixed upstream, raise the
openpulsefloor in thepulseextra inpyproject.toml
and add the spec examples as test fixtures. - Until then, improve the error surfaced to users.
"Failed to parse OpenPulse string: Unexpected token 'port'"gives no indication that this is a known upstream limitation
rather than a mistake in their program. - Decide whether to carry a temporary workaround — see below.
Implementation Details
- The pulse path is
src/pyqasm/pulse/;cal/defcalbodies are handed to
openpulse.parser.parse_openpulse, and the error above is re-raised from there. The
pulseextra pinsopenpulse>=1.0.1inpyproject.toml. - Possible interim workaround: strip a leading
externfromport/framedeclarations
before handing the body to the parser, then mark the resulting symbol as externally provided
inpyqasm's own frame/port table (src/pyqasm/pulse/frame.py).port d0;and
frame f = newframe(...);already parse, so the rewrite is narrow. It is a text-level
workaround and should be gated behind a clear comment and removed once upstream lands —
maintainer call on whether that trade is worth it. - Verify against the latest
openpulserelease before filing upstream; this was reproduced on
1.0.1. - Tests: add the spec's Ports, Frames and Calibrations-in-practice examples as fixtures, marked
xfailwith a reference to the upstream issue so they flip to passing automatically when the
dependency is bumped.
- 主要言語
- Python
- スター
- 29
- フォーク
- 33
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
qBraid/pyqasm のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
enhancement error-handling program-validation
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.py対応中かも @danielgaskins が 11 日前に担当しました。 オープンenhancement qasm2
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
qBraid/pyqasm#447 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASM対応中かも @Jah-yee が 19 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
qBraid/pyqasm#438 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Parse failures raise ValidationError with an empty message; the ANTLR diagnostic is lost対応中かも @tonycoder-hub が 12 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 22/100
qBraid/pyqasm#436 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Project submission:オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
slavakurilyak/awesome-ai-agents#845 ·
メンテナーはふだん 1 日以内に返信
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directory対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdifficulty:2 enhancement good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
MakazhanAlpamys/Soup#2178 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
scverse/rapids-singlecell#854 ·
メンテナーはふだん 1 日以内に返信
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGL対応中かも @ninglinLiu が今日担当しました。 オープンarea:frontend backend:slang bug direction:input
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=False対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 13 日以内に返信