Verbose Information on TypeError runtime crashes?
还没有人认领这个 Issue。
评估
调研方向
未指定文件、测试或入口点。首先定位生成 PyArray 转换 TypeError 文本的位置,然后确定类型参数和参数名称在那里是否可用;完成的标准是有一种已定义且经过测试的方法,能够在不产生未指定的运行时开销的情况下提供所请求的额外上下文。
由索引模型根据 Issue 内容生成。
描述
Thank you for pyo3.
Using pyo3, when my python code sends the wrong shape (can typically happen given python's dynamic typing during any development work) I get a python backtrace going down to my line of code calling into my rust, and a text error description like:
TypeError: 'float64' object cannot be converted to 'PyArray<T, D>'
Is there a more verbose mode to pyo3 runtime for cases like this?
Of course if my dev workflow is linear enough, I know I should check my types at that line and have good context in mind for quickly resolving it even without re-running with try-except for logging more details.
However it would be nice to have more information already in the error description if possible:
- What are the type values of
TandD? - Which function argument is the error arising for?
Of course, user code can always try-except the offending python call and we can work to reproduce that crash in repeat runs, even if it's outside the development cycle. But having more information by default provides more peace of mind knowing that before you have managed to reproduce you have some more details than the line of user code. All-in-all this is an enhancement which some may object if it adds runtime cost, especially for release builds.
Consider that when we expose rust code to python, some python developers would much appreciate knowing more about the expected types than those developers who understand pyo3 or can directly work with the rust code.
- 主要语言
- Rust
- 星标
- 1.4k
- 派生
- 141
- 平均合并
- 16 分钟
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PyO3/rust-numpy 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
PyO3/rust-numpy#565 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 58/100
PyO3/rust-numpy#563 ·
-
难度 3/5 1-2 天 新手友好度 56/100
PyO3/rust-numpy#557 ·
-
难度 3/5 1-2 天 新手友好度 45/100
PyO3/rust-numpy#547 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 20/100
PyO3/rust-numpy#535 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
BurntSushi/jiff#653 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
ZcashFoundation/zeeder#106 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
oxidize-rb/rb-sys#807 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
todo:ticket
难度 2/5 1-2 天 新手友好度 74/100