Skip to content

Support Ruby 4 - #75

Merged
diogob merged 1 commit into
diogob:masterfrom
mtam2:support-ruby-4
Sep 3, 2026
Merged

Support Ruby 4#75
diogob merged 1 commit into
diogob:masterfrom
mtam2:support-ruby-4

Conversation

@mtam2

@mtam2 mtam2 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Ruby 4 chills string literals in files that have no magic comment: a
literal is still mutable, but mutating one warns that it will be frozen
in the future. The gem's one such site is the copy_to_string result
buffer, so the suite passes on Ruby 4 today and the warning only
surfaces under -W:deprecated.

Opt lib/postgres-copy/acts_as_copy_target.rb into frozen string literals
ahead of that change, and seed the result buffer with +'' so it stays
mutable. Refresh the development bundle for Ruby 4, allow a compatible
Rake release, and exercise Ruby 4 in CI.

Use +'' rather than String.new because String.new with no arguments
returns an ASCII-8BIT string, which would flip copy_to_string's result
encoding for exports whose every byte is ASCII. +'' keeps the UTF-8 the
method returned before.

Ruby 4 chills string literals in files that have no magic comment: a
literal is still mutable, but mutating one warns that it will be frozen
in the future. The gem's one such site is the copy_to_string result
buffer, so the suite passes on Ruby 4 today and the warning only
surfaces under -W:deprecated.

Opt lib/postgres-copy/acts_as_copy_target.rb into frozen string literals
ahead of that change, and seed the result buffer with +'' so it stays
mutable. Refresh the development bundle for Ruby 4, allow a compatible
Rake release, and exercise Ruby 4 in CI.

Use +'' rather than String.new because String.new with no arguments
returns an ASCII-8BIT string, which would flip copy_to_string's result
encoding for exports whose every byte is ASCII. +'' keeps the UTF-8 the
method returned before.
@diogob
diogob merged commit 11e650e into diogob:master Sep 3, 2026
4 checks passed
@diogob

diogob commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Thanks for the pull request @mtam2 , sorry the merge took a while.
The new version is published.

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