1. Ronald Oussoren
  2. pyobjc

Commits

Ronald Oussoren  committed a85be66

Use ``with open(...)`` to explictly close files

  • Participants
  • Parent commits d396f80
  • Branches default

Comments (0)

Files changed (1)

File pyobjc-core/setup.py

View file
 from setuptools.command import egg_info
 
 def write_header(cmd, basename, filename):
-    data = open(os.path.join('Modules/objc/', os.path.basename(basename)), 'rU').read()
+    with open(os.path.join('Modules/objc/', os.path.basename(basename)), 'rU') as fp:
+        data = fp.read()
     if not cmd.dry_run:
         if not os.path.exists(os.path.dirname(filename)):
             os.makedirs(os.path.dirname(filename))