SIGN IN SIGN UP

Issue #15989: Fix several occurrences of integer overflow

when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
S
Serhiy Storchaka committed
9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3