Skip to content

Never use identity comparison for Ruby objects.#97

Closed
headius wants to merge 1 commit intoruby:1-4-stablefrom
headius:identity_fix_1-4-stable
Closed

Never use identity comparison for Ruby objects.#97
headius wants to merge 1 commit intoruby:1-4-stablefrom
headius:identity_fix_1-4-stable

Conversation

@headius
Copy link
Contributor

@headius headius commented Nov 19, 2018

This is a 1.4-compatible version of #92. I need this in a racc release to fix jruby/jruby#5401 so I have created this PR to get consensus that this is ok to go in 1-4-stable branch.

Numeric objects in JRuby do not have guarantees of idempotence. In
this code, many places used object equality to compare two Fixnum
objects, a situation which is never guaranteed to work, and which
is much more likely to fail when JRuby's cache of low-valued
Fixnum objects is turned off as in jruby/jruby#5401. This patch
removes all such object identity comparisons and replaces them
with .equals calls.

Numeric objects in JRuby do not have guarantees of idempotence. In
this code, many places used object equality to compare two Fixnum
objects, a situation which is never guaranteed to work, and which
is much more likely to fail when JRuby's cache of low-valued
Fixnum objects is turned off as in jruby/jruby#5401. This patch
removes all such object identity comparisons and replaces them
with .equals calls.
@hsbt
Copy link
Member

hsbt commented Oct 30, 2019

@headius Can you rebase from the current 1-4-stable branch?

@hsbt hsbt closed this Dec 10, 2019
@hsbt
Copy link
Member

hsbt commented Dec 10, 2019

I did rename 1-4-stable to master branch. If you still need this change, Can you submit to master branch? Thanks!

@headius
Copy link
Contributor Author

headius commented Jan 9, 2020

Looks like I committed this myself?

e30754b

@headius headius deleted the identity_fix_1-4-stable branch January 9, 2020 15:54
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