[Python-checkins] r51932 - sandbox/branches/setuptools-0.6/setuptools/tests/doctest.py

phillip.eby python-checkins at python.org
Wed Sep 20 22:22:05 CEST 2006


Author: phillip.eby
Date: Wed Sep 20 22:22:04 2006
New Revision: 51932

Modified:
   sandbox/branches/setuptools-0.6/setuptools/tests/doctest.py
Log:
Backport some Python 2.5 compatibility work


Modified: sandbox/branches/setuptools-0.6/setuptools/tests/doctest.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/tests/doctest.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/tests/doctest.py	Wed Sep 20 22:22:04 2006
@@ -1330,11 +1330,13 @@
     __LINECACHE_FILENAME_RE = re.compile(r'<doctest '
                                          r'(?P<name>[\w\.]+)'
                                          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)
         if m and m.group('name') == self.test.name:
             example = self.test.examples[int(m.group('examplenum'))]
             return example.source.splitlines(True)
+        elif self.save_linecache_getlines.func_code.co_argcount>1:
+            return self.save_linecache_getlines(filename, module_globals)
         else:
             return self.save_linecache_getlines(filename)
 


More information about the Python-checkins mailing list