merge revision(s) 79eb75a8dd: [Backport #20025]

[Bug #20025] Check if upper/lower before fallback to case-folding
This commit is contained in:
Hiroshi SHIBATA 2025-03-13 13:29:59 +09:00
parent 774e3f0003
commit 998c26cd28
3 changed files with 8 additions and 3 deletions

View file

@ -222,10 +222,10 @@ rb_sym_constant_char_p(const char *name, long nlen, rb_encoding *enc)
if (!MBCLEN_CHARFOUND_P(c)) return FALSE;
len = MBCLEN_CHARFOUND_LEN(c);
c = rb_enc_mbc_to_codepoint(name, end, enc);
if (rb_enc_isupper(c, enc)) return TRUE;
if (rb_enc_islower(c, enc)) return FALSE;
if (ONIGENC_IS_UNICODE(enc)) {
static int ctype_titlecase = 0;
if (rb_enc_isupper(c, enc)) return TRUE;
if (rb_enc_islower(c, enc)) return FALSE;
if (!ctype_titlecase) {
static const UChar cname[] = "titlecaseletter";
static const UChar *const end = cname + sizeof(cname) - 1;

View file

@ -134,5 +134,10 @@ module Test_Symbol
Bug::Symbol.find(cx)
}
end
def test_const_name_type
sym = "\xb5".force_encoding(Encoding::Windows_1253)
assert_not_operator Bug::Symbol, :const?, sym, sym.encode(Encoding::UTF_8)
end
end
end

View file

@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 260
#define RUBY_PATCHLEVEL 261
#include "ruby/version.h"
#include "ruby/internal/abi.h"