Sure a computer can handle infinity. Like this in Javascript:
Of course that is not very useful apart from the fact that it alerts you as to failure in your code.
With the magic of big number libraries we can work with numbers as big as can fit in memory. Python just happens to have this built into the language. Integers only mind.
Aside: The world record for calculating the digits of Pi stands at 13 trillion digits. It was done on basically a regular Intel computer!