NDArray.__setitem__ raises AttributeError for list index keys
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
src/blosc2/ndarray.py の NDArray.setitem にある高度なインデックス指定の分岐から始め、特に 5106~5108 行付近のスカラーのブールキーのチェックを確認してください。リストキーおよびタプルキーを使った代入を、正常に動作する NumPy 配列のケースと比較してください。これらの代入で AttributeError が発生しなくなり、既存の配列キーの動作も引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Assigning with a fancy index that is a Python list, or a tuple that contains an index array or list, raises AttributeError (main d3bca9e5 and 4.14.1). Reading with the same keys works, and an index array as the whole key works too.
import blosc2, numpy as np
a = blosc2.zeros((20, 30, 40), dtype=np.float32)
idx = np.array([1, 3, 5])
a[idx] = np.ones((3, 30, 40), np.float32) # ok
a[[1, 3, 5]] = np.ones((3, 30, 40), np.float32) # AttributeError: 'list' object has no attribute 'shape'
a[[1, 3, 5], 3:17] = np.ones((3, 14, 40), np.float32) # AttributeError: 'tuple' object has no attribute 'shape'
a[idx, 3:17] = np.ones((3, 14, 40), np.float32) # AttributeError: 'tuple' object has no attribute 'shape'
a[2, [1, 3, 5]] = np.ones((3, 40), np.float32) # AttributeError: 'tuple' object has no attribute 'shape'
a[[1, 3, 5], 3:17] # reading works
Cause. The fancy-index branch of NDArray.__setitem__ checks for a scalar boolean key on the original key, key.shape == () and hasattr(key, "dtype") and ... (ndarray.py#L5106-L5108), which only works when key is a NumPy array. Testing isinstance(key, np.ndarray) (or getattr(key, "shape", None) == ()) first should be enough.
Found while testing write paths for #763; not fixed there to keep that PR to one change.
- 主要言語
- Python
- スター
- 214
- フォーク
- 72
- 平均マージ
- 3日 9時間
- マージ済み PR(30日)
- 24
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Blosc/python-blosc2 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Blosc/python-blosc2#757 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Blosc/python-blosc2#731 ·
メンテナーはふだん 2 日以内に返信
-
documentation sustain-2026
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Blosc/python-blosc2#720 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
sustain-2026
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Blosc/python-blosc2#717 ·
メンテナーはふだん 2 日以内に返信
-
documentation sustain-2026
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
Blosc/python-blosc2#714 ·
メンテナーはふだん 2 日以内に返信
Blosc/python-blosc2 の issue をすべて見る
似ている issue
-
[BUG]: Compliance rules never see Unity Catalog views as views対応中かも @wagnercsantos が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
databrickslabs/ontos#1348 ·
メンテナーはふだん 3 日以内に返信
-
`forum_pr_poster` action will always return `none` when checking for pre-existing feedback threads, even if a feedback thread already exists.対応中かも @pgmzeta が今日担当しました。 オープンE-Verified P-Major
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
goonstation/goonstation#28259 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
woonstadrotterdam/monumenten#70 ·
メンテナーはふだん 15 日以内に返信
-
binding:python bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
The Browser tab fails with a Wayland error when Open Terminal runs from a Wayland desktop sessionオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-webui/open-terminal#210 ·