# HG changeset patch # User Mads Kiilerich # Date 1678205618 -3600 # Node ID 972f3e5c94b835fc0640674e2baf0aeaf4f43c3a # Parent 805d4a462abb7b09d1a51edfba6285e3c0007c45 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. diff -r 805d4a462abb -r 972f3e5c94b8 mercurial/statprof.py --- 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, )