[PATCH 3 of 7 V3] statprof: require paths to save or load profile data

Yuya Nishihara yuya at tcha.org
Wed Nov 2 08:45:00 EDT 2016


On Tue, 01 Nov 2016 19:11:07 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1471227245 25200
> #      Sun Aug 14 19:14:05 2016 -0700
> # Node ID 4cd53260f947639e140a61b0698d9da1032d3794
> # Parent  4f740964f8843bdcb08a668ae1cf37ef153eba25
> statprof: require paths to save or load profile data

> -def load_data(path=None):
> -    path = path or (os.environ['HOME'] + '/statprof.data')
> +def load_data(path):
>      lines = open(path, 'r').read().splitlines()

Maybe we need to fix main() to not pass None, as a follow-up.

% ./mercurial/statprof.py hotpath
Traceback (most recent call last):
  File "./mercurial/statprof.py", line 803, in <module>
    sys.exit(main())
  File "./mercurial/statprof.py", line 796, in main
    load_data(path=path)
  File "./mercurial/statprof.py", line 338, in load_data
    lines = open(path, 'r').read().splitlines()
TypeError: coercing to Unicode: need string or buffer, NoneType found


More information about the Mercurial-devel mailing list