[Python-checkins] cpython: Issues #29349: Add NEWS for 3.7; use “with” statement

martin.panter python-checkins at python.org
Sun Jan 29 05:34:31 EST 2017


https://hg.python.org/cpython/rev/ca7d2af9920e
changeset:   106335:ca7d2af9920e
user:        Martin Panter <vadmium+py at gmail.com>
date:        Sun Jan 29 10:17:17 2017 +0000
summary:
  Issues #29349: Add NEWS for 3.7; use “with” statement

files:
  Doc/tools/extensions/patchlevel.py |  5 +----
  Misc/NEWS                          |  2 ++
  2 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/Doc/tools/extensions/patchlevel.py b/Doc/tools/extensions/patchlevel.py
--- a/Doc/tools/extensions/patchlevel.py
+++ b/Doc/tools/extensions/patchlevel.py
@@ -22,15 +22,12 @@
     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'])
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -663,6 +663,8 @@
 Documentation
 -------------
 
+- Issue #29349: Fix Python 2 syntax in code for building the documentation.
+
 - Issue #23722: The data model reference and the porting section in the
   3.6 What's New guide now cover the additional ``__classcell__`` handling
   needed for custom metaclasses to fully support PEP 487 and zero-argument

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list