JuliaPy / JuliaPy/PythonCall.jl
Two calls needed to pyimport a module in Julia, the first one crashes
- 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:** PythonCall
I installed sagelib using CondaPkg in Julia:
`pkg> conda add sagelib`
But importing it requires two calls for sage.all. Here is a Julia session:
```
┌──(greg㉿ellipse)-[~]
└─$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.7 (2025-09-08)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> using PythonCall
julia> sg=pyimport("sage.all")
ERROR: Python: TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Python stacktrace:
[1] signal
@ signal ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/signal.py:58
[2] cysignals.pysignals.setsignal
@ cysignals/pysignals.pyx:319
[3] cysignals.pysignals.changesignal.__exit__
@ cysignals/pysignals.pyx:373
[4] init cysignals.pysignals
@ cysignals/pysignals.pyx:488
[5] init sage.interfaces.process (build/cythonized/sage/interfaces/process.c:7112)
@ sage/interfaces/process.pyx:24
[6]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/parallel/use_fork.py:22
[7]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py:33
[8]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/arithmetic_dynamics/projective_ds.py:66
[9]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/arithmetic_dynamics/all.py:5
[10]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/all.py:25
[11]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/all.py:127
Stacktrace:
[1] pythrow()
@ PythonCall.Core ~/.julia/packages/PythonCall/mkWc2/src/Core/err.jl:77
[2] errcheck
@ ~/.julia/packages/PythonCall/mkWc2/src/Core/err.jl:10 [inlined]
[3] pyimport(m::String)
@ PythonCall.Core ~/.julia/packages/PythonCall/mkWc2/src/Core/builtins.jl:1458
[4] top-level scope
@ REPL[2]:1
julia> sg=pyimport("sage.all")
Python:
julia> sg.factor(sg.ZZ(376655555555555555554444444444443332346777712))
Python: 2^4 * 53 * 163 * 12391 * 219914853701821004027468433435262943
julia> sg.log(2.3)
Python: 0.832909122935104
```
Kali Linux on WSL
PythonCall v0.9.28
CondaPkg v0.2.33
Python version:
Python: '3.12.11 | packaged by conda-forge | (main, Jun 4 2025, 15:10:57) [GCC 13.3.0]'
sagelib v10.7
I wonder what happens here since in pure Python that works.
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 with the pyimport entry point and error-handling paths named in PythonCall.Core/builtins.jl, then reproduce the first and second imports using the reported Julia, PythonCall, CondaPkg, and sagelib versions. Done means the first pyimport("sage.all") succeeds without the signal-handler TypeError and the existing functionality remains usable.
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
- backend
- 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