Skip to content

Ensure compatibility with frozen string literals - #643

Merged
tompng merged 1 commit into
ruby:masterfrom
casperisfine:frozen-string-literal-compat
Mar 14, 2024
Merged

tompng merged 1 commit into
ruby:masterfrom
casperisfine:frozen-string-literal-compat

Conversation

@casperisfine

Copy link
Copy Markdown
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.

@casperisfine
casperisfine force-pushed the frozen-string-literal-compat branch from e42c048 to 5207a8d Compare March 13, 2024 11:57
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`.
@casperisfine
casperisfine force-pushed the frozen-string-literal-compat branch from 5207a8d to 4fa92c6 Compare March 13, 2024 12:08
Comment thread lib/reline/windows.rb
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
Copy Markdown
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

@tompng tompng left a comment

Copy link
Copy Markdown
Member

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
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
Copy Markdown
Contributor Author

Thanks for the merge!

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.

3 participants