JuliaPy / PythonCall.jl

Python and Julia in harmony.
https://juliapy.github.io/PythonCall.jl/stable/
MIT License
715 stars 61 forks source link

`@pyexec` broken: `ERROR: LoadError: UndefVarError: `MacroTools` not defined` #479

Closed lassepe closed 3 months ago

lassepe commented 3 months ago

Affects: PythonCall

Describe the bug

The following code used to work but is broken on the latest release and current master:

(@v1.10) pkg> activate --temp

julia> using PythonCall

julia> PythonCall.@pyexec (err = "asdf") => `raise err`
ERROR: LoadError: UndefVarError: `MacroTools` not defined
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/MacroTools/Cf2ok/src/match/macro.jl:67 [inlined]
 [2] _pyeval_macro_args(arg::Expr, filename::String, mode::String)
   @ PythonCall.Core ~/.julia/packages/PythonCall/vW5OI/src/Core/builtins.jl:1273
 [3] var"@pyexec"(__source__::LineNumberNode, __module__::Module, arg::Any)
   @ PythonCall.Core ~/.julia/packages/PythonCall/vW5OI/src/Core/builtins.jl:1346
in expression starting at REPL[3]:1

System

julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 9 5900HX with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 16 default, 0 interactive, 8 GC (on 16 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
  JULIA_LSP_JULIA_BIN = /home/lassepe/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/bin/julia
  JULIA_SYSIMAGE_LIB_DIR = /home/lassepe/worktree/SystemImagePrecompile.jl/builds
lassepe commented 3 months ago

I guess this is just https://github.com/FluxML/MacroTools.jl/issues/30