Repository navigation
Ensure compatibility with frozen string literals - #643
Merged
Merged
Conversation
casperisfine
force-pushed
the
frozen-string-literal-compat
branch
from
March 13, 2024 11:57
e42c048 to
5207a8d
Compare
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
force-pushed
the
frozen-string-literal-compat
branch
from
March 13, 2024 12:08
5207a8d to
4fa92c6
Compare
casperisfine
commented
Mar 14, 2024
| 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" |
Contributor
Author
There was a problem hiding this comment.
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
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>
Contributor
Author
|
Thanks for the merge! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.