Skip to content

Make use of new data type for lengths in ruby-4.1+ - #754

Merged
larskanis merged 3 commits into
ged:masterfrom
larskanis:rb_len_t
Oct 17, 2026
Merged

larskanis merged 3 commits into
ged:masterfrom
larskanis:rb_len_t

Conversation

@larskanis

Copy link
Copy Markdown
Collaborator

Comment thread ext/pg_binary_decoder.c Outdated

if (cur_ptr < line_end_ptr)
rb_raise( rb_eArgError, "trailing data after binary array data at position: %ld", (long)(cur_ptr - input_line) + 1 );
rb_raise( rb_eArgError, "trailing data after binary array data at position: %td", (cur_ptr - input_line) + 1 );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cbandy for reviewing! I'll probably roll back the changes to print("%td..., because it breaks Truffleruby.

Truffleruby fails to print %td at runtime with:

expected ArgumentError with message matching /trailing data.*at position: 7$/, got #<ArgumentError: unhandled rb_sprintf arg type 26> with backtrace:
          /home/runner/.rubies/truffleruby-head/lib/truffle/truffle/cext.rb:1369:in 'Truffle::CExt#rb_exc_raise'
          /home/runner/.rubies/truffleruby-head/lib/truffle/truffle/cext_ruby.rb:83:in 'PG::BinaryDecoder::CopyRow#decode'
          ./spec/pg/type_spec.rb:1574:in 'block (7 levels) in <top (required)>'
          ./spec/pg/type_spec.rb:1574:in 'block (6 levels) in <top (required)>'
          ./spec/helpers.rb:64:in 'block in PG::TestingHelpers.included'
          /home/runner/.rubies/truffleruby-head/lib/mri/rubygems.rb:304:in 'Gem.activate_and_load_bin_path'
      ./spec/pg/type_spec.rb:1574:in 'block (6 levels) in <top (required)>'
      ./spec/helpers.rb:64:in 'block in PG::TestingHelpers.included'
@larskanis
larskanis merged commit 1583016 into ged:master Oct 17, 2026
35 checks passed
@larskanis
larskanis deleted the rb_len_t branch October 17, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants