JuliaPy / JuliaPy/PythonCall.jl

Inconsistency implicit type conversion

オープン
#536 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Julia
スター
1.1k
フォーク
86
平均マージ
1日 22時間
マージ済み PR(30日)
3

説明

**Affects:** Both PythonCall and JuliaCall

**Describe the bug**
I am encountering inconsistent behavior with implicit type conversion when calling a Python function from Julia within a Python file. Specifically, I have observed that the variable 'global_res' is of type 'Julia Float64', whereas res is of type 'Py'. I expected both to be of the same type—Julia Float64—since they are both ultimately handled on the Julia side, where I assumed implicit conversion would occur uniformly. Here is the problematic code segment:
```
from juliacall import Main as jl

jl.seval("""
using PythonCall
""")

jl.global_res = 0

def my_test(x):
jl.global_res = x+1
return x+1

jl.test_pyexec_fn = my_test

jl.seval("""
function jl_add(x::Float64)
res = test_pyexec_fn(x)
println("typeof res:",typeof(res)) #typeof res:Py
println("typeof global_res:",typeof(global_res)) #typeof global_res:Float64
return res
end
""")

x = jl.jl_add(2.0)
```

**Your system**
Information about my system:
- The operating system: Linux
- The versions:
- Julia:1.10.3,
- Python:3.9.19,
- juliacall: 0.9.21,
- PythonCall v0.9.20

Thank you so much in advance!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by running the reported Python and Julia reproduction with Julia 1.10.3, Python 3.9.19, juliacall 0.9.21, and PythonCall v0.9.20. Inspect the conversion behavior around test_pyexec_fn, jl.global_res, and jl.jl_add, comparing the reported Py and Float64 results. Done should mean the inconsistency is explained and the intended conversion behavior is fixed or clearly documented.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
julia, python
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。