Decoding a <blob> value in an unknown format returns None instead of raising an error

未关闭 适合新手
#1,703 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
databases

调研方向

从 src/datajoint/blob.py 第192–194行附近开始,这里 blob.unpack 会处理无法识别的头部;将这条处理路径与 issue 中描述的损坏压缩值行为进行比较。更新行为,使未知的 blob 格式引发 DataJointError。然后检查 issue 中的示例是否引发预期的错误,以及有效格式是否仍能解码。

由索引模型根据 Issue 内容生成。

描述

bug

blob.unpack returns None when the bytes do not start with a known header, mYm\0 or dj0\0, whether or not they are compressed (blob.py#L192-L194). BlobCodec.decode passes that through. A corrupted or foreign value in a <blob> column therefore fetches as None, and can't be told apart from NULL.

from datajoint import blob

blob.unpack(b"garbage\0data")         # None
blob.unpack(b"no terminator here")    # None
blob.unpack(b"")                      # None

A corrupt compressed value does raise DataJointError (master, eefe74b4).

Expected

A DataJointError that says the value is not in a known blob format.

Suggested fix

Raise in unpack when the header is not recognized.

主要语言
Python
星标
198
派生
103
平均合并
6 天 1 小时
30 天内合并 PR
10

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

datajoint/datajoint-python 的其他 Issue

查看 datajoint/datajoint-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。