[1.7.x] Fixed #22820 -- Treated int and long types alike in lazy_number

Thanks kwist for the report and the initial patch.
Backport of 5021421799 from master.