From: "augustingbpe (Augustin Gottlieb) via ruby-core" Date: 2026-11-24T19:42:28+00:00 Subject: [ruby-core:127704] [Ruby Bug#22407] IO::Buffer#set_value does not call to_int for 128-bit values Issue #22407 has been updated by augustingbpe (Augustin Gottlieb). I opened https://github.com/ruby/ruby/pull/20132 for this, it calls to_int for the 128-bit types the same way the smaller types do. ---------------------------------------- Bug #22407: IO::Buffer#set_value does not call to_int for 128-bit values https://bugs.ruby-lang.org/issues/22407#change-120217 * Author: hanazuki (Kasumi Hanazuki) * Status: Assigned * Assignee: ioquatix (Samuel Williams) * ruby -v: ruby 4.1.0dev (2026-10-05T15:26:55Z master 2c1e694a53) +PRISM [x86_64-linux] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- IO::Buffer gained support for reading and writing 128-bit integers (:u128, :U128, :s128, and :S128) in Ruby 4.0 (commit:a7dc53b91c8475323b34d5a332fdb25d190e277d). Unlike the other smaller integer types, IO::Buffer#set_value does not call to_int on non-Integer values for the 128-bit types. Same for #set_values. ```ruby IntegerLike = Data.define(:value) do def to_int = value end buf = IO::Buffer.new(16) buf.set_value(:u64, 0, IntegerLike.new(42)) buf.set_value(:u128, 0, IntegerLike.new(42)) # => not an integer (TypeError) ``` Hence the 128-bit integer types do not satisfy this statement in the method's documentation: > Note that if the type is integer and value is Float, the implicit truncation is performed -- 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/