Fix expecttest accept on Python 3.8 and later (#59709)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59709
Fixes #59705.
Python 3.8 fixed tracebacks to report the beginning of the line
that raised an error, rather than the end. This makes for a simpler
implementation (no more string reversing) but need to actually
implement. This wasn't caught by tests because we hard coded line
numbers to do substitutions, so I also added a little smoketest to
detect future changes to traceback line number behavior.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Reviewed By: bdhirsh
Differential Revision: D28994919
Pulled By: ezyang
fbshipit-source-id: 1fb0a782e17c55c13d668fabd04766d2b3811962