Mercurial > hg
changeset 50305:972f3e5c94b8 stable
statprof: with Python 3.12, lineno is (more) often None
test-profile.t failed with errors like:
TypeError: %d format: a real number is required, not NoneType
statprof.py already handled None values as -1 in some cases. Do the same in
more cases.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 07 Mar 2023 17:13:38 +0100 |
parents | 805d4a462abb |
children | 90276164333a c5e93c915ab6 |
files | mercurial/statprof.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/statprof.py Tue Mar 07 16:45:54 2023 +0100 +++ b/mercurial/statprof.py Tue Mar 07 17:13:38 2023 +0100 @@ -540,7 +540,11 @@ for stat in stats: site = stat.site - sitelabel = b'%s:%d:%s' % (site.filename(), site.lineno, site.function) + sitelabel = b'%s:%d:%s' % ( + site.filename(), + site.lineno or -1, + site.function, + ) fp.write( b'%6.2f %9.2f %9.2f %s\n' % ( @@ -613,7 +617,7 @@ stattuple = ( stat.selfpercent(), stat.selfseconds(), - stat.site.lineno, + stat.site.lineno or -1, source, )