diff options
| author | nagachika <nagachika@ruby-lang.org> | 2022-09-25 21:24:30 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2022-09-25 21:24:30 +0900 |
| commit | e46532feafadef252682794c941180df72483c19 (patch) | |
| tree | 6db8b46f28b7c72e784868e8b1b07c61a81c30f8 | |
| parent | d1b36c827036765ab68c88ab4315a26a220d5f06 (diff) | |
merge revision(s) cf7d07570f50ef9c16007019afcff11ba6500d70: [Backport #18938]
Dump non-ASCII char as unsigned
Non-ASCII code may be negative on platforms plain char is signed.
---
ext/objspace/objspace_dump.c | 2 +-
test/objspace/test_objspace.rb | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
| -rw-r--r-- | ext/objspace/objspace_dump.c | 2 | ||||
| -rw-r--r-- | test/objspace/test_objspace.rb | 15 | ||||
| -rw-r--r-- | version.h | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index cf7acb5c6f..47081754c9 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -141,7 +141,7 @@ dump_append_sizet(struct dump_config *dc, const size_t number) } static void -dump_append_c(struct dump_config *dc, char c) +dump_append_c(struct dump_config *dc, unsigned char c) { if (c <= 0x1f) { const unsigned int width = (sizeof(c) * CHAR_BIT / 4) + 5; diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index a1954d56a9..bdc9c8c3d7 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -632,4 +632,19 @@ class TestObjSpace < Test::Unit::TestCase assert_equal '42', out[2] end end + + def test_utf8_method_names + name = "utf8_❨╯°□°❩╯︵┻━┻" + obj = ObjectSpace.trace_object_allocations do + __send__(name) + end + dump = ObjectSpace.dump(obj) + assert_equal name, JSON.parse(dump)["method"], dump + end + + private + + def utf8_❨╯°□°❩╯︵┻━┻ + "1#{2}" + end end @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 3 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 63 +#define RUBY_PATCHLEVEL 64 #define RUBY_RELEASE_YEAR 2022 #define RUBY_RELEASE_MONTH 9 |
