[ruby-cvs:68373] eregon:r61192 (trunk): Do not change Encoding.default_internal in assert_raise_with_message

eregon at ruby-lang.org eregon at ruby-lang.org
Wed Dec 13 06:51:54 JST 2017


eregon	2017-12-13 06:51:53 +0900 (Wed, 13 Dec 2017)

  New Revision: 61192

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61192

  Log:
    Do not change Encoding.default_internal in assert_raise_with_message
    
    * It is not thread-safe: if two threads call it concurrently,
      the default_internal Encoding might not be restored, which causes
      many problems. The same applies for $VERBOSE, which might also not be
      restored to its original value but to the new value instead.
      This happens because reading the original value might capture the
      value already changed by EnvUtil.with_default_internal in another
      Thread. One solution could be to capture the value of these globals
      before running the test.
    * Reverts part of r54522.

  Modified files:
    trunk/test/lib/test/unit/assertions.rb


More information about the ruby-cvs mailing list