]> granicus.if.org Git - python/commitdiff
Have distutils.sysconfig close a file to remove ResourceWarnings coming up
authorBrett Cannon <bcannon@gmail.com>
Fri, 29 Oct 2010 22:36:08 +0000 (22:36 +0000)
committerBrett Cannon <bcannon@gmail.com>
Fri, 29 Oct 2010 22:36:08 +0000 (22:36 +0000)
during the build from setup.py.

Lib/distutils/sysconfig.py

index 6b5daa51903012b391762f4ffe91a6c3df24df70..8b55f217cdc5226720bddc67e4bc2938350debea 100644 (file)
@@ -413,7 +413,8 @@ def _init_posix():
     # load the installed pyconfig.h:
     try:
         filename = get_config_h_filename()
-        parse_config_h(io.open(filename), g)
+        with open(filename) as file:
+            parse_config_h(file, g)
     except IOError as msg:
         my_msg = "invalid Python installation: unable to open %s" % filename
         if hasattr(msg, "strerror"):