# HG changeset patch # User Mads Kiilerich # Date 1678205618 -3600 # Tue Mar 07 17:13:38 2023 +0100 # Branch stable # Node ID 6ab12a75c936e0f1bf4305b9fdf9960219d1a39c # Parent 72ba5a6dbb52570fbdfa07ce15ac6ad88e35f63c 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 --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -540,7 +540,7 @@ def display_by_line(data, fp): 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 +613,7 @@ def display_by_method(data, fp): stattuple = ( stat.selfpercent(), stat.selfseconds(), - stat.site.lineno, + stat.site.lineno or -1, source, ) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel