py: Fix up source-line calculation.

Should address issue #475.