aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever.FTA@GMail.Com>2012-12-29 05:27:56 +0100
committerArfrever Frehtes Taifersar Arahesis <Arfrever.FTA@GMail.Com>2012-12-29 05:27:56 +0100
commit5f6ebc0579291a7dd316e2a64466e688ef7bdb69 (patch)
tree557bbcb02451b21ed6f96d9c0ecf067d528b6a12
parent73e70541ad60633c5b373eeafab1cfba6e81606c (diff)
downloadexternal_python_setuptools-5f6ebc0579291a7dd316e2a64466e688ef7bdb69.tar.gz
external_python_setuptools-5f6ebc0579291a7dd316e2a64466e688ef7bdb69.tar.bz2
external_python_setuptools-5f6ebc0579291a7dd316e2a64466e688ef7bdb69.zip
Issue #341: Fix a ResourceWarning.
--HG-- branch : distribute extra : rebase_source : 63fc40de80b49769d8463e04c1590ea4b1e751fc
-rw-r--r--CHANGES.txt1
-rw-r--r--pkg_resources.py4
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 6f6d9a8d..c1c648df 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -12,6 +12,7 @@ CHANGES
* Fix issue in pkg_resources where try/except around a platform-dependent
import would trigger hook load failures on Mercurial. See pull request 32
for details.
+* Issue #341: Fix a ResourceWarning.
------
0.6.32
diff --git a/pkg_resources.py b/pkg_resources.py
index 85e008a2..939a7c64 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1761,11 +1761,13 @@ def find_on_path(importer, path_item, only=False):
for dist in find_distributions(os.path.join(path_item, entry)):
yield dist
elif not only and lower.endswith('.egg-link'):
- for line in open(os.path.join(path_item, entry)):
+ entry_file = open(os.path.join(path_item, entry))
+ for line in entry_file:
if not line.strip(): continue
for item in find_distributions(os.path.join(path_item,line.rstrip())):
yield item
break
+ entry_file.close()
register_finder(ImpWrapper,find_on_path)
if importlib_bootstrap is not None: