From b97e909ef476a6facbaec665a205fee486371044 Mon Sep 17 00:00:00 2001 From: st0012 Date: Sun, 2 Oct 2022 10:20:26 +0100 Subject: [ruby/irb] Remove unnecessary Thread presence check They were introduced around 20 years ago, when Thread is not yet stabilized. So we don't need them anymore. https://github.com/ruby/irb/commit/4c75e03b2b --- lib/irb.rb | 6 +----- lib/irb/context.rb | 2 +- lib/irb/ext/multi-irb.rb | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/irb.rb b/lib/irb.rb index 9a3a491641..0c145069c0 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -389,11 +389,7 @@ module IRB # # Will raise an Abort exception, or the given +exception+. def IRB.irb_abort(irb, exception = Abort) - if defined? Thread - irb.context.thread.raise exception, "abort then interrupt!" - else - raise exception, "abort then interrupt!" - end + irb.context.thread.raise exception, "abort then interrupt!" end class Irb diff --git a/lib/irb/context.rb b/lib/irb/context.rb index b74cae1223..a3b7dda8cd 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -32,7 +32,7 @@ module IRB else @workspace = WorkSpace.new end - @thread = Thread.current if defined? Thread + @thread = Thread.current # copy of default configuration @ap_name = IRB.conf[:AP_NAME] diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb index 74de1ecde5..e57d43a569 100644 --- a/lib/irb/ext/multi-irb.rb +++ b/lib/irb/ext/multi-irb.rb @@ -9,7 +9,6 @@ # # # -fail CantShiftToMultiIrbMode unless defined?(Thread) module IRB class JobManager -- cgit v1.2.3