diff options
author | Martin Panter <vadmium+py@gmail.com> | 2017-01-29 10:17:17 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2017-01-29 10:17:17 (GMT) |
commit | c654f0acf91eb38a312c12dcaf6902c14dcfc885 (patch) | |
tree | 2e8631b16fc5a292b66953a1ecb0bbe788e191ab /Doc | |
parent | 3a6dc19f6ea42a43e64b9c0b75d8a7792c16330a (diff) | |
download | cpython-c654f0acf91eb38a312c12dcaf6902c14dcfc885.zip cpython-c654f0acf91eb38a312c12dcaf6902c14dcfc885.tar.gz cpython-c654f0acf91eb38a312c12dcaf6902c14dcfc885.tar.bz2 |
Issues #29349: Add NEWS for 3.7; use “with” statement
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/tools/extensions/patchlevel.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Doc/tools/extensions/patchlevel.py b/Doc/tools/extensions/patchlevel.py index 9558b9c..9ba32bd 100644 --- a/Doc/tools/extensions/patchlevel.py +++ b/Doc/tools/extensions/patchlevel.py @@ -22,15 +22,12 @@ def get_header_version_info(srcdir): rx = re.compile(r'\s*#define\s+([a-zA-Z][a-zA-Z_0-9]*)\s+([a-zA-Z_0-9]+)') d = {} - f = open(patchlevel_h) - try: + with open(patchlevel_h) as f: for line in f: m = rx.match(line) if m is not None: name, value = m.group(1, 2) d[name] = value - finally: - f.close() release = version = '%s.%s' % (d['PY_MAJOR_VERSION'], d['PY_MINOR_VERSION']) micro = int(d['PY_MICRO_VERSION']) |