ComplexTypeMetaDataMixin.deserialize has no None guard.
还没有人认领这个 Issue。
评估
调研方向
阅读 metadata.py,找到 issue 指出缺少 None 检查的 ComplexTypeMetaDataMixin.deserialize。首先运行或调整提供的 BaseDataClass.deserialize(None, set()) pytest 示例。当反序列化对该输入返回 None,且回归测试通过时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Steps to Reproduce:
- Define a Rune type with an optional complex-type field (cardinality 0..1).
- Construct an instance from a dict that omits the field, or pass None for it
explicitly — pydantic calls the field's PlainValidator with obj=None. - Observe the exception.
Expected Result:
None is returned, allowing the optional field to remain absent.
Actual Result:
PydanticCustomError is raised:
"Expected either or dict but got <class 'NoneType'>."
Environment:
rune-python-runtime 2.2.2, pydantic 2.14.1, Python 3.11
Additional Context:
metadata.py ComplexTypeMetaDataMixin.deserialize performs no None check before
the isinstance dispatch chain. None is not a list, not an instance of cls,
not a Reference, and not a dict, so it falls through to the error branch.
Fix: add if obj is None: return None as the first check in deserialize.
import pytest
from pydantic_core import PydanticCustomError
from rune.runtime.base_data_class import BaseDataClass
def test_r1_complex_type_deserialize_none_raises():
'''Passing None to ComplexTypeMetaDataMixin.deserialize raises PydanticCustomError instead of returning None.'''
with pytest.raises(PydanticCustomError):
BaseDataClass.deserialize(None, set())
- 主要语言
- Python
- 星标
- 0
- 派生
- 4
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
finos/rune-python-runtime 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
finos/rune-python-runtime#52 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
finos/rune-python-runtime#51 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
finos/rune-python-runtime#50 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
finos/rune-python-runtime#48 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
finos/rune-python-runtime#43 ·
查看 finos/rune-python-runtime 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
CLIMADA-project/climada_python#1337 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
8go/matrix-commander#233 ·
-
documentation
难度 2/5 1-3 小时 新手友好度 66/100
-
documentation enhancement priority:high size:M
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backend可能已有人在做 @debesh-biswas 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100