Skip to content

Conversation

@KristofferC
Copy link
Member

Should fix #49510.

@singularitti, could you try this?

@KristofferC KristofferC added REPL Julia's REPL (Read Eval Print Loop) bugfix This change fixes an existing bug backport 1.9 Change should be backported to release-1.9 labels May 10, 2023
@singularitti
Copy link
Contributor

Sure, I can. How do I test, BTW? Is there a built version for this? Or I have to fix Julia source files in my installation?

@singularitti
Copy link
Contributor

I tried modifying the stdlib files. Unfortunately, it still happens:

ChatGPT> Can you give me a quick example of exponentiating a matrix in Julia?
ERROR: type MD has no field args
Stacktrace:
  [1] getproperty
    @ ./Base.jl:37 [inlined]
  [2] get_usings!(usings::Vector{Any}, ex::Markdown.MD)
    @ REPL.Numbered ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1425
  [3] out_transform(x::Any, n::Base.RefValue{Int64})
    @ REPL.Numbered ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1415
  [4] (::REPL.Numbered.var"#5#6"{Base.RefValue{Int64}})(ast::Any)
    @ REPL.Numbered ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1478
  [5] #invokelatest#2
    @ ./essentials.jl:816 [inlined]
  [6] invokelatest
    @ ./essentials.jl:813 [inlined]
  [7] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
    @ REPL ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:151
  [8] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:249
  [9] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:234
 [10] run_repl(repl::AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:379
 [11] run_repl(repl::AbstractREPL, consumer::Any)
    @ REPL ~/.asdf/installs/julia/1.9.0/share/julia/stdlib/v1.9/REPL/src/REPL.jl:365
 [12] (::Base.var"#1017#1019"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:421
 [13] #invokelatest#2
    @ ./essentials.jl:816 [inlined]
 [14] invokelatest
    @ ./essentials.jl:813 [inlined]
 [15] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:405
 [16] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:322
 [17] _start()
    @ Base ./client.jl:522

@singularitti
Copy link
Contributor

singularitti commented May 12, 2023

I need to comment these lines in my startup.jl to make it work:

if !isdefined(repl, :interface)
    repl.interface = REPL.setup_interface(repl)
end
REPL.numbered_prompt!(repl)

@KristofferC KristofferC mentioned this pull request May 19, 2023
51 tasks
@KristofferC KristofferC mentioned this pull request Jun 6, 2023
36 tasks
@KristofferC KristofferC mentioned this pull request Jul 11, 2023
35 tasks
KristofferC added a commit that referenced this pull request Aug 18, 2023
Backported PRs:
- [x] #47782 <!-- Generalize Bool parse method to AbstractString -->
- [x] #48634 <!-- Remove unused "deps" mechanism in internal sorting
keywords [NFC] -->
- [x] #49931 <!-- Lock finalizers' lists at exit -->
- [x] #50064 <!-- Fix numbered prompt with input only with comment -->
- [x] #50474 <!-- docs: Fix a `!!! note` which was miscapitalized -->
- [x] #50516 <!-- Fix visibility of assert on GCC12/13 -->
- [x] #50635 <!-- `versioninfo()`: include build info and unofficial
warning -->
- [x] #49915 <!-- Revert "Remove number / vector (#44358)" -->
- [x] #50781 <!-- fix `bit_map!` with aliasing -->
- [x] #50845 <!-- fix #50438, use default pool for at-threads -->
- [x] #49031 <!-- Update inference.md -->
- [x] #50289 <!-- Initialize prev_nold and nold in gc_reset_page -->
- [x] #50559 <!-- Expand kwcall lowering positional default check to
vararg -->
- [x] #49582 <!-- Update HISTORY.md for `DelimitedFiles` -->
- [x] #50341 <!-- invokelatest docs should say not exported before 1.9
-->
- [x] #50525 <!-- only check that values are finite in `generic_lufact`
when `check=true` -->
- [x] #50444 <!-- Optimize getfield lowering to avoid boxing in some
cases -->
- [x] #50523 <!-- Avoid generic call in most cases for getproperty -->
- [x] #50860 <!-- Add `Base.get_extension` to docs/API -->
- [x] #50164 <!-- codegen: handle dead code with unsafe_store of FCA
pointers -->
- [x] #50568 <!-- `Array(::AbstractRange)` should return an `Array` -->
- [x] #50871 <!-- macOS: Don't inspect dead threadtls during exception
handling. -->

Need manual backport:
- [ ] #48542 <!-- Add docs on task-specific buffering using
multithreading -->
- [ ] #50591 <!-- build: fix various makefile bugs -->


Non-merged PRs with backport label:
- [ ] #50842 <!-- Avoid race conditions with recursive rm -->
- [ ] #50823 <!-- Make ranges more robust with unsigned indexes. -->
- [ ] #50663 <!-- Fix Expr(:loopinfo) codegen -->
- [ ] #49716 <!-- Update varinfo() docstring signature -->
- [ ] #49713 <!-- prevent REPL from erroring in numbered mode in some
situations -->
- [ ] #49573 <!-- Implement jl_cpu_pause on PPC64 -->
- [ ] #48726 <!-- fix macro expansion of property destructuring -->
- [ ] #48642 <!-- Use gc alloc instead of alloc typed in lowering -->
- [ ] #48183 <!-- Don't use pkgimage for package if any includes fall in
tracked path for coverage or alloc tracking -->
- [ ] #48050 <!-- improve `--heap-size-hint` arg handling -->
- [ ] #47615 <!-- Allow threadsafe access to buffer of type inference
profiling trees -->
@vtjnash
Copy link
Member

vtjnash commented Oct 1, 2025

Bug was already fixed by #50064, but these are still nice improvements

@vtjnash vtjnash added merge me PR is reviewed. Merge when all tests are passing and removed backport 1.9 Change should be backported to release-1.9 labels Oct 1, 2025
KristofferC and others added 2 commits October 2, 2025 08:39
# get all `using` and `import` statements which are at the top level
for (i, arg) in enumerate(ex.args)
for i in 1:length(ex.args)
arg = ex.args[i]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The

push!(usings, popat!(ex.args, i))

below is kind of sneaky (mutating what we iterate over).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that mean we used to skip over the next entry after the first using?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we just revert #49098? It seems like this is just entirely too broken

@vtjnash
Copy link
Member

vtjnash commented Oct 2, 2025

Replaced by #59730

@vtjnash vtjnash closed this Oct 2, 2025
@DilumAluthge DilumAluthge deleted the kc/arg_usings branch October 3, 2025 01:03
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug REPL Julia's REPL (Read Eval Print Loop)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPython mode seems to cause error: type MD has no field args

5 participants