Never return the internal module name as a mutable string.#5481
Merged
enebo merged 2 commits intojruby:masterfrom Nov 29, 2018
Merged
Never return the internal module name as a mutable string.#5481enebo merged 2 commits intojruby:masterfrom
enebo merged 2 commits intojruby:masterfrom
Conversation
This duplicates logic in `to_s` that dups the module name before returning it, but also ensures that any cached module name is frozen so it can't be modified in place. Fixes jruby#5480.
e4e8d81 to
d3b31dd
Compare
Member
|
@headius this sort of makes sense how it broke. Because we were a string before we would always make a RubyString from the string and we did not cache that finished string. Not sure if we always marked it frozen or not before. |
Member
Author
|
@enebo I didn't see any evidence that we froze it, but it makes sense to do so. That inner method was added by you in 9.2 so it seems safe enough to make it now return a frozen string reference. |
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.
This duplicates logic in
to_sthat dups the module name beforereturning it, but also ensures that any cached module name is
frozen so it can't be modified in place.
Fixes #5480.