diff options
author | John Hawthorn <john@hawthorn.email> | 2023-12-05 13:44:28 -0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-12-25 21:12:49 +0900 |
commit | ea5776e7e4262c915f7f8b8884af420dd87d769c (patch) | |
tree | 69afb3ac0d4b8eaead1e912155f5c32b7c38b774 /ext/json | |
parent | 65ec74a8dd6114d4496fde2661c4d3efe917b849 (diff) | |
download | ruby-ea5776e7e4262c915f7f8b8884af420dd87d769c.tar.gz |
[flori/json] Use rb_sym2str instead of SYM2ID
This avoids pinning an id to the symbol used if a dynamic symbol is
passed in as a hash key.
rb_sym2str is available in Ruby 2.2+ and json depends on >= 2.3.
https://github.com/flori/json/commit/5cbafb8dbe
Diffstat (limited to 'ext/json')
-rw-r--r-- | ext/json/generator/generator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c index a71acfbb76..a33df848df 100644 --- a/ext/json/generator/generator.c +++ b/ext/json/generator/generator.c @@ -867,7 +867,7 @@ json_object_i(VALUE key, VALUE val, VALUE _arg) if (klass == rb_cString) { key_to_s = key; } else if (klass == rb_cSymbol) { - key_to_s = rb_id2str(SYM2ID(key)); + key_to_s = rb_sym2str(key); } else { key_to_s = rb_funcall(key, i_to_s, 0); } |