[ruby-core:123489] [Ruby Bug#21641] Hash#to_s behaves different in 3.4
From:
"matheussilvasantos (Matheus Oliveira) via ruby-core" <ruby-core@...>
Date:
2025-10-16 18:03:07 UTC
List:
ruby-core #123489
Issue #21641 has been reported by matheussilvasantos (Matheus Oliveira).
----------------------------------------
Bug #21641: Hash#to_s behaves different in 3.4
https://bugs.ruby-lang.org/issues/21641
* Author: matheussilvasantos (Matheus Oliveira)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
I couldn't find anywhere documenting this change from Ruby 3.3 to Ruby 3.4:
3.3.9:
``` ruby
> irb
3.3.9 :001 > {x:1}.to_s
=> "{:x=>1}"
3.3.9 :002 >
```
3.4.0:
```ruby
3.4.0 :001 > {x:1}.to_s
=> "{x: 1}"
3.4.0 :002 >
```
Is there a way to continue with the old behaviour - flag to compilation, monkey patch, etc.?
Unfortunately, the application I'm working on stores the `to_s` in Redis and use it later; if the result doesn't match for the same Hash, it would break a few things.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/