Ruby 2.4.1 Released: What’s Changed

Ruby 2.4.1, a ‘teeny’ release, has been released. If you want the raw files, the official Ruby site has the goodies, or you can check out the Downloads section below.

Mar 22, 2017 · 3 min read

I’m going to quickly run through what’s different compared to Ruby 2.4.0 and why you should consider upgrading (or not). I’ve tried to put things into a rough order of priority or personal interest.

Most of the changes are fixes for regressions, with the Onigmo regular expression engine update introducing the only new “feature” I could find.


  • Onigmo, the regular expressions library and Oniguruma fork that powers Ruby’s regex support, has been updated to version 6.1.1. This introduces support for the absent operator which I’ve done a full write-up about.
  • RubyGems has been upgraded to 2.6.10 from 2.6.8. No significant changes.
  • Resolution of bug #13313: Segmentation fault when calling with Symbol proc shorthand — p, &:to_s).value caused Ruby to die on 2.4.0.
  • Resolution of bug #13090: Cannot use return statement in lambdas using instance_eval — This meant instance_eval(&lambda { |_| return }) would raise a LocalJumpError exception on 2.4.0. Now resolved.
  • Resolution of bug #12705: yielding args to a lambda uses block/proc rather than lambda/method semantics. (This strikes me as being related to #13090 above.)
  • Resolution of bug #12884: Using a HashWithIndifferentAccess with a default value in a function with a keyword parameter converts it to a Hash. (The way Ruby’s keyword arguments feature works seems to have been interfering with non-Hash hashes used as default values on the first parameter of a method that also uses keyword arguments. Try saying that ten times in a row! This appears to have been a problem since Ruby 2.2.)
  • Resolution of bug #8996: pthread_mutex_lock EINVAL
  • Resolution of bug #9605: Chaining “each_with_index.detect &lambda” raises ArgumentError the thread on the bug is worth reading for this unusual case.
  • Resolution of bug #13074: When executing instance_exec with symbol.to_proc, it ignores first argument.
  • Tempfile#size now returns 0 (rather than nil) when an empty file is written. More.
  • Fixed that (?~\S+) in a regex might cause an infinite loop.
  • 4r**40000000 (or essentially any rational raised to a high enough power) would cause a segfault. It now returns Infinity, as with integers. More.
  • Resolution of bug #12613: iseq_set_sequence: adjust bug -1 < 0 (retry inside begin/rescue)
  • Resolution of bug #12855: Inconsistent keys identity in compare_by_identity Hash when using literals
  • Resolution of bug #13073: Hash Key => Proc parse failure
  • Resolution of bug #13076: SEGV in io.c when reading closed stream in Thread
  • Resolution of bug #13085: io.c io_fwrite creates garbage
  • Resolution of bug #13096: error using undef_method + refinements
  • Resolution of bug #13158: UNIXServer#closed? returns false after UNIXServer#close called
  • Resolution of bug #13176: Segfault during exception raising because rb_thread_t.errinfo is set to IMEMO object
  • Resolution of bug #13227: Crash when refine subclass method and call super
  • Resolution of bug #13234: Infinite recursion (stack overflow) in parse_char_class()
  • Resolution of bug #13242: SIGSEGV in rb_bigzero_p()
  • Resolution of bug #13287: Stack consistency error (sp: 97, bp: 96)
  • Resolution of bug #13325: Block is not passed to Symbol proc if using refinements. (There’s an example of this in the fix.)
  • A fix for valid_encoding? when used with UTF32.
  • #fdiv on large Integers has been made very slightly more precise. You could be working on orbital mechanics calculations for this to have an impact, however :-)
  • Big improvements to the documentation for rss/atom.
  • Lots of the typical documentation tweaks and fixes, including clarifying the documents for puts that its record separator is always a newline.


RVM is also already updated, so if you’re using that:

rvm get head
rvm install 2.4.1

Ruby Inside

Ruby articles and posts

Peter Cooper

Written by

Friendly chief publisher at @CooperPress, programmer, editor of JavaScript Weekly and more.

Ruby Inside

Ruby articles and posts