1. Nick Coghlan
  2. setuptools

Commits

Jason R. Coombs  committed 4c49f59

Use context manager

  • Participants
  • Parent commits 7954605
  • Branches default

Comments (0)

Files changed (1)

File pkg_resources.py

View file
         return open(self._fn(self.module_path, resource_name), 'rb')
 
     def _get(self, path):
-        stream = open(path, 'rb')
-        try:
+        with open(path, 'rb') as stream:
             return stream.read()
-        finally:
-            stream.close()
 
 register_loader_type(type(None), DefaultProvider)