Commit 7e0489e5 authored by PJ Eby's avatar PJ Eby

Backport some Python 2.5 compatibility work

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4051932
parent 7231e489
...@@ -1330,11 +1330,13 @@ class DocTestRunner: ...@@ -1330,11 +1330,13 @@ class DocTestRunner:
__LINECACHE_FILENAME_RE = re.compile(r'<doctest ' __LINECACHE_FILENAME_RE = re.compile(r'<doctest '
r'(?P<name>[\w\.]+)' r'(?P<name>[\w\.]+)'
r'\[(?P<examplenum>\d+)\]>$') r'\[(?P<examplenum>\d+)\]>$')
def __patched_linecache_getlines(self, filename): def __patched_linecache_getlines(self, filename, module_globals=None):
m = self.__LINECACHE_FILENAME_RE.match(filename) m = self.__LINECACHE_FILENAME_RE.match(filename)
if m and m.group('name') == self.test.name: if m and m.group('name') == self.test.name:
example = self.test.examples[int(m.group('examplenum'))] example = self.test.examples[int(m.group('examplenum'))]
return example.source.splitlines(True) return example.source.splitlines(True)
elif self.save_linecache_getlines.func_code.co_argcount>1:
return self.save_linecache_getlines(filename, module_globals)
else: else:
return self.save_linecache_getlines(filename) return self.save_linecache_getlines(filename)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment