diff options
author | Tres Seaver <tseaver@palladion.com> | 2012-12-29 12:54:21 -0500 |
---|---|---|
committer | Tres Seaver <tseaver@palladion.com> | 2012-12-29 12:54:21 -0500 |
commit | d73c8722858cc7aaca77a22d0e84795bc6262420 (patch) | |
tree | cb6133a5ebce995828478059a40a8571a5679bc8 /pkg_resources.py | |
parent | 721559fe76a1cda3de639ee2aaa446595169d26b (diff) | |
download | external_python_setuptools-d73c8722858cc7aaca77a22d0e84795bc6262420.tar.gz external_python_setuptools-d73c8722858cc7aaca77a22d0e84795bc6262420.tar.bz2 external_python_setuptools-d73c8722858cc7aaca77a22d0e84795bc6262420.zip |
Harden fix for issue #341 against exceptins.
--HG--
branch : distribute
extra : rebase_source : 5cb7f22523a741e678b03a699f0ef09f09ed8070
Diffstat (limited to 'pkg_resources.py')
-rw-r--r-- | pkg_resources.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 939a7c64..cb8d3dcf 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -1762,12 +1762,14 @@ def find_on_path(importer, path_item, only=False): yield dist elif not only and lower.endswith('.egg-link'): 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() + try: + 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 + finally: + entry_file.close() register_finder(ImpWrapper,find_on_path) if importlib_bootstrap is not None: |