Port python 0/0 = infinity fix.

self-merge to we can work. @kiril - review.

Did you intentionally define infinity as MAXINT to avoid json serialization issues?