Skip to content

Fix String#to_i with leading zero and underscores#7934

Merged
headius merged 2 commits intojruby:jruby-9.3from
headius:string_to_i_underscores
Sep 10, 2023
Merged

Fix String#to_i with leading zero and underscores#7934
headius merged 2 commits intojruby:jruby-9.3from
headius:string_to_i_underscores

Conversation

@headius
Copy link
Member

@headius headius commented Sep 10, 2023

Logic here is intended to bail out when the leading digit is 0 and there are two or more consecutive underscores, but it appears it was ported incorrectly (us += 0 🤨) resulting in it bailing out after ANY second underscore.

Fixes #7749.

We're only supposed to bail out on 2 or more consecutive
underscores. Probably ported wrong since us += 0 makes 0 sense.

Fixes jruby#7749
Specifically for cases with leading zeros, which falls into logic
in CRuby that ignores any number of non-consecutivee underscores
but bails out on two or more consecutive underscores.
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.

1 participant