From: busch.michael@... Date: 2020-12-15T14:22:01+00:00 Subject: [ruby-core:101464] [Ruby master Bug#17395] Kernel::Integer does not raise ArgumentError for strings with whitespace padding Issue #17395 has been reported by mikelikesbikes (Mike Busch). ---------------------------------------- Bug #17395: Kernel::Integer does not raise ArgumentError for strings with whitespace padding https://bugs.ruby-lang.org/issues/17395 * Author: mikelikesbikes (Mike Busch) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin18] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- According to the Kernel::Integer docs, ArgumentError should be raised if the argument is a String and doesn't conform with numerical representation. However, it appears that Kernel::Integer does not raise ArgumentError when a string contains leading or trailing whitespace. Ruby Version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin18] Reproduce Steps: ``` Integer(" 1") Integer("1 ") ``` Actual Results: both parse to a valid Integer, 1, no exception is raised. Expected Results: both should raise ArgumentError because they contain non-numerical characters -- https://bugs.ruby-lang.org/ Unsubscribe: