summaryrefslogtreecommitdiff
path: root/lib/irb.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-03-26 16:43:16 +0900
committeraycabta <aycabta@gmail.com>2020-03-26 17:41:21 +0900
commit22477128cd77e0d0dce7e78bc12f9cc8cccc1cb4 (patch)
treeb0c88a22f80a3f4609cf00bc3dcd0a251a7698b9 /lib/irb.rb
parentffbb162f1a052054ce2864d2971e83da10f8aa78 (diff)
[ruby/irb] Suppress crashing when EncodingError has occurred without lineno
https://github.com/ruby/irb/commit/13572d8cdc
Diffstat (limited to 'lib/irb.rb')
-rw-r--r--lib/irb.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index e73174e..ee6979c 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -554,7 +554,8 @@ module IRB
def handle_exception(exc)
if exc.backtrace && exc.backtrace[0] =~ /\/irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ &&
- !(SyntaxError === exc)
+ !(SyntaxError === exc) && !(EncodingError === exc)
+ # The backtrace of invalid encoding hash (ex. {"\xAE": 1}) raises EncodingError without lineno.
irb_bug = true
else
irb_bug = false