From: Zac Medico Date: Wed, 17 Oct 2012 22:57:38 +0000 (-0700) Subject: glsa.py: use try/finally for urlopen X-Git-Tag: v2.2.0_alpha141~24 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0e5e75ce80bbc9e4dd231c693861fc9b43f677c1;p=portage.git glsa.py: use try/finally for urlopen Fixes this error reported with python 2.7.3: AttributeError: addinfourl instance has no attribute '__exit__' --- diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index f26dc8be2..d3c3b3da7 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -473,8 +473,13 @@ class Glsa: myurl = "file://"+self.nr else: myurl = repository + "glsa-%s.xml" % str(self.nr) - with urllib_request_urlopen(myurl) as f: + + f = urllib_request_urlopen(myurl) + try: self.parse(f) + finally: + f.close() + return None def parse(self, myfile):