diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2016-07-06 00:11:37 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2016-07-06 00:11:37 (GMT) |
commit | 5ce1b86b0e69c7518704caddf1e8fddece7f3d74 (patch) | |
tree | 240cbc8f23139a79106a1a53777f4c8b001b6449 /Lib/idlelib | |
parent | e3c1d34c653b24a7d956f6b6ab12094546cf8920 (diff) | |
parent | 2279aeb2824a90dd1f6765f826b48b497cd89ea0 (diff) | |
download | cpython-5ce1b86b0e69c7518704caddf1e8fddece7f3d74.zip cpython-5ce1b86b0e69c7518704caddf1e8fddece7f3d74.tar.gz cpython-5ce1b86b0e69c7518704caddf1e8fddece7f3d74.tar.bz2 |
Issue #27452: add line counter and crc to IDLE config test dump.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/config.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py index 4d87de0..51ef21b 100644 --- a/Lib/idlelib/config.py +++ b/Lib/idlelib/config.py @@ -738,19 +738,30 @@ idleConf = IdleConf() # TODO Revise test output, write expanded unittest # if __name__ == '__main__': + from zlib import crc32 + line, crc = 0, 0 + + def sprint(obj): + global line, crc + txt = str(obj) + line += 1 + crc = crc32(txt.encode(encoding='utf-8'), crc) + print(txt) + #print('***', line, crc, '***') # uncomment for diagnosis + def dumpCfg(cfg): - print('\n', cfg, '\n') - for key in cfg: + print('\n', cfg, '\n') # has variable '0xnnnnnnnn' addresses + for key in sorted(cfg.keys()): sections = cfg[key].sections() - print(key) - print(sections) + sprint(key) + sprint(sections) for section in sections: options = cfg[key].options(section) - print(section) - print(options) + sprint(section) + sprint(options) for option in options: - print(option, '=', cfg[key].Get(section, option)) + sprint(option + ' = ' + cfg[key].Get(section, option)) + dumpCfg(idleConf.defaultCfg) dumpCfg(idleConf.userCfg) - print(idleConf.userCfg['main'].Get('Theme', 'name')) - #print idleConf.userCfg['highlight'].GetDefHighlight('Foo','normal') + print('\nlines = ', line, ', crc = ', crc, sep='') |