Backport PR #46119 on branch 1.4.x (REF: isinstance(x, int) -> is_integer(x))
Backport PR #46119: REF: isinstance(x, int) -> is_integer(x)
Alternative to #46500, is to backport and follow-up with a test and release note.

As this is not atomic, personally I prefer the revert and redo option. I think either might work, i probably prefer just the add tests and whats new option personally due to simplicity. I think this PR is fine