ruby-changes:63789
From: Nobuyoshi <ko1@a...>
Date: Sat, 28 Nov 2020 18:51:52 +0900 (JST)
Subject: [ruby-changes:63789] 85aabef023 (master): [Feature #17136] Remove special behavior from $KCODE
https://git.ruby-lang.org/ruby.git/commit/?id=85aabef023 From 85aabef023e1a2e81c308ad98741137c73d4d80b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 31 Aug 2020 22:13:34 +0900 Subject: [Feature #17136] Remove special behavior from $KCODE diff --git a/re.c b/re.c index 55b39bf..2af617e 100644 --- a/re.c +++ b/re.c @@ -3920,19 +3920,6 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp) https://github.com/ruby/ruby/blob/trunk/re.c#L3920 } static VALUE -kcode_getter(ID _x, VALUE *_y) -{ - rb_warn("variable $KCODE is no longer effective"); - return Qnil; -} - -static void -kcode_setter(VALUE val, ID id, VALUE *_) -{ - rb_warn("variable $KCODE is no longer effective; ignored"); -} - -static VALUE ignorecase_getter(ID _x, VALUE *_y) { rb_warn("variable $= is no longer effective"); @@ -4062,8 +4049,6 @@ Init_Regexp(void) https://github.com/ruby/ruby/blob/trunk/re.c#L4049 rb_gvar_ractor_local("$+"); rb_define_virtual_variable("$=", ignorecase_getter, ignorecase_setter); - rb_define_virtual_variable("$KCODE", kcode_getter, kcode_setter); - rb_define_virtual_variable("$-K", kcode_getter, kcode_setter); rb_cRegexp = rb_define_class("Regexp", rb_cObject); rb_define_alloc_func(rb_cRegexp, rb_reg_s_alloc); diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 6243ead..e124fc7 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -661,21 +661,11 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L661 assert_equal('foobazquux/foobazquux', result, bug8856) end - def test_KCODE - assert_nil($KCODE) - assert_nothing_raised { $KCODE = nil } - end - def test_ignorecase assert_equal(false, $=) assert_nothing_raised { $= = nil } end - def test_KCODE_warning - assert_warning(/variable \$KCODE is no longer effective; ignored/) { $KCODE = nil } - assert_warning(/variable \$KCODE is no longer effective/) { $KCODE = nil } - end - def test_ignorecase_warning assert_warning(/variable \$= is no longer effective; ignored/) { $= = nil } assert_warning(/variable \$= is no longer effective/) { $= } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/