JuliaPy / JuliaPy/PythonCall.jl
Julia objects are falsely marked as subtypes of most Python abstract base classes.
- Ngôn ngữ chính
- Julia
- Star
- 1.1k
- Fork
- 86
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 3
Mô tả
**Affects:** JuliaCall
**Describe the bug**
An example of this that I ran into is that everything is reported as itterable, even when it cannot be iterated.
This looks pretty bad on the surface:
```pycon
>>> import collections
>>> isinstance([1,2,3], collections.abc.Iterable)
True
>>> isinstance(1, collections.abc.Iterable)
False
>>> isinstance(sum, collections.abc.Iterable)
False
>>> f = jl.seval("f(x) = x+1")
>>> isinstance(f, collections.abc.Iterable)
True
>>> s = jl.seval(":a")
>>> isinstance(s, collections.abc.Iterable)
True
>>> f
Julia: f (generic function with 1 method)
>>> s
Julia: :a
```
And indeed it causes bugs when passing non-iterable Julia objects to Python functions which check for iterability and then, if iterable, iterate. For example, this function in PyTorch:
https://github.com/pytorch/pytorch/blob/185e76238d9f634c9c8d6fc6be75aa4fc71e04d3/torch/autograd/gradcheck.py#L78-L87
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start by reproducing the isinstance examples from the issue in PythonCall.jl, including the Julia function and Symbol cases, then trace how Julia objects interact with collections.abc.Iterable checks. Done means genuinely non-iterable Julia objects are no longer reported as Iterable and the cited PyTorch gradcheck scenario behaves correctly.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- julia, python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100