Show More
@@ -236,18 +236,14 b' class CodeSite(object):' | |||||
236 | def getsource(self, length): |
|
236 | def getsource(self, length): | |
237 | if self.source is None: |
|
237 | if self.source is None: | |
238 | lineno = self.lineno - 1 |
|
238 | lineno = self.lineno - 1 | |
239 | fp = None |
|
|||
240 | try: |
|
239 | try: | |
241 |
|
|
240 | with open(self.path, 'rb') as fp: | |
242 | for i, line in enumerate(fp): |
|
241 | for i, line in enumerate(fp): | |
243 | if i == lineno: |
|
242 | if i == lineno: | |
244 | self.source = line.strip() |
|
243 | self.source = line.strip() | |
245 | break |
|
244 | break | |
246 | except: |
|
245 | except: | |
247 | pass |
|
246 | pass | |
248 | finally: |
|
|||
249 | if fp: |
|
|||
250 | fp.close() |
|
|||
251 | if self.source is None: |
|
247 | if self.source is None: | |
252 | self.source = '' |
|
248 | self.source = '' | |
253 |
|
249 |
General Comments 0
You need to be logged in to leave comments.
Login now