mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Remove support for the Regexp.new 3rd argument
This was deprecated in Ruby 3.2. Fixes [Bug #18797]
This commit is contained in:
parent
6207a3f588
commit
04cfb26bd3
Notes:
git
2023-03-02 07:43:07 +00:00
2 changed files with 2 additions and 45 deletions
15
re.c
15
re.c
|
@ -3912,10 +3912,10 @@ reg_extract_args(int argc, VALUE *argv, struct reg_init_args *args)
|
|||
{
|
||||
int flags = 0;
|
||||
rb_encoding *enc = 0;
|
||||
VALUE str, src, opts = Qundef, n_flag = Qundef, kwargs;
|
||||
VALUE str, src, opts = Qundef, kwargs;
|
||||
VALUE re = Qnil;
|
||||
|
||||
argc = rb_scan_args(argc, argv, "12:", &src, &opts, &n_flag, &kwargs);
|
||||
rb_scan_args(argc, argv, "11:", &src, &opts, &kwargs);
|
||||
|
||||
args->timeout = Qnil;
|
||||
if (!NIL_P(kwargs)) {
|
||||
|
@ -3926,10 +3926,6 @@ reg_extract_args(int argc, VALUE *argv, struct reg_init_args *args)
|
|||
rb_get_kwargs(kwargs, keywords, 0, 1, &args->timeout);
|
||||
}
|
||||
|
||||
if (argc == 3) {
|
||||
rb_warn_deprecated_to_remove("3.3", "3rd argument to Regexp.new", "2nd argument");
|
||||
}
|
||||
|
||||
if (RB_TYPE_P(src, T_REGEXP)) {
|
||||
re = src;
|
||||
|
||||
|
@ -3948,13 +3944,6 @@ reg_extract_args(int argc, VALUE *argv, struct reg_init_args *args)
|
|||
else if (!NIL_P(opts) && rb_bool_expected(opts, "ignorecase", FALSE))
|
||||
flags = ONIG_OPTION_IGNORECASE;
|
||||
}
|
||||
if (!NIL_OR_UNDEF_P(n_flag)) {
|
||||
char *kcode = StringValuePtr(n_flag);
|
||||
if (kcode[0] == 'n' || kcode[0] == 'N') {
|
||||
enc = rb_ascii8bit_encoding();
|
||||
flags |= ARG_ENCODING_NONE;
|
||||
}
|
||||
}
|
||||
str = StringValue(src);
|
||||
}
|
||||
args->str = str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue