Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show 'Maybe IRB bug!' in show_source and ls command #1039

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Nov 27, 2024

ls command shows Maybe IRB bug! when eval fails.

irb(main):001> ls foo
undefined local variable or method `foo' for main (NameError)
[backtraces]
Maybe IRB bug!

irb(main):001> ls raise(Exception)
Exception (Exception)
[backtraces]
Maybe IRB bug!

irb(main):001> ls (1.."a")
bad value for range (ArgumentError)
[backtraces]
Maybe IRB bug!

Same for show_source

irb(main):001> show_source (1.."a").itself
bad value for range (ArgumentError)
Maybe IRB bug!

irb(main):001> show_source raise(Exception).itself
Exception (Exception)
Maybe IRB bug!

This pull request fixes it.

irb(main):001> ls foo
NameError: undefined local variable or method `foo' for main
irb(main):002> ls raise(Exception,'aa')
Exception: aa
irb(main):003> ls Integer, grep: /#{raise Exception,'bb'}/
Exception: bb
irb(main):004> show_source raise(Exception,'aa').itself
Error: Couldn't locate a definition for raise(Exception,'aa').itself

The use of args, kwargs = ruby_args(arg) (in legacy ls format) is also removed.

@st0012 st0012 added the bug Something isn't working label Dec 3, 2024
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Thx 👍

@st0012 st0012 merged commit 9eb14a3 into ruby:master Dec 3, 2024
28 checks passed
@tompng tompng deleted the ls_show_source_no_irb_bug branch December 4, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants