Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure compatibility with frozen string literals #643

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

casperisfine
Copy link
Contributor

Ref: https://bugs.ruby-lang.org/issues/20205

Ruby is moving forward with enabling frozen string literals in the future.

Reline being part of the ruby-core test suite should work when ruby is ran with --enable-frozen-string-literal.

Ref: https://bugs.ruby-lang.org/issues/20205

Ruby is moving forward with enabling frozen string literals
in the future.

Reline being part of the ruby-core test suite should work when
ruby is ran with `--enable-frozen-string-literal`.
@@ -85,7 +85,7 @@ def initialize(dllname, func, import, export = "0", calltype = :stdcall)
def call(*args)
import = @proto.split("")
args.each_with_index do |x, i|
args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for ruby 2.6 compatibility, because it has a bug in pack("p"):

$ ruby -v -e '["a".freeze].pack("p")'
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
-e:1:in `pack': can't modify frozen String (FrozenError)
	from -e:1:in `<main>'

Seem to have been fixed in 2.7

Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

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

Thank you

@tompng tompng merged commit 7e2de64 into ruby:master Mar 14, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Mar 14, 2024
(ruby/reline#643)

Ref: https://bugs.ruby-lang.org/issues/20205

Ruby is moving forward with enabling frozen string literals
in the future.

Reline being part of the ruby-core test suite should work when
ruby is ran with `--enable-frozen-string-literal`.

ruby/reline@7e2de64cf0

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
@casperisfine
Copy link
Contributor Author

Thanks for the merge!

artur-intech pushed a commit to artur-intech/ruby that referenced this pull request Apr 26, 2024
(ruby/reline#643)

Ref: https://bugs.ruby-lang.org/issues/20205

Ruby is moving forward with enabling frozen string literals
in the future.

Reline being part of the ruby-core test suite should work when
ruby is ran with `--enable-frozen-string-literal`.

ruby/reline@7e2de64cf0

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants