Ticket #2771: patch_to_doctest.diff

File patch_to_doctest.diff, 1.1 KB (added by ymasuda, 9 years ago)

Patch to trunk/test/doctest.py

  • test/doctest.py

     
    13191319    __LINECACHE_FILENAME_RE = re.compile(r'<doctest '
    13201320                                         r'(?P<name>[\w\.]+)'
    13211321                                         r'\[(?P<examplenum>\d+)\]>$')
    1322     def __patched_linecache_getlines(self, filename):
     1322    def __patched_linecache_getlines(self, filename, module_globals=None):
    13231323        m = self.__LINECACHE_FILENAME_RE.match(filename)
    13241324        if m and m.group('name') == self.test.name:
    13251325            example = self.test.examples[int(m.group('examplenum'))]
    13261326            return example.source.splitlines(True)
    13271327        else:
    1328             return self.save_linecache_getlines(filename)
     1328            if sys.hexversion < 0x020500a1:
     1329                return self.save_linecache_getlines(filename)
     1330            else:
     1331                return self.save_linecache.getlines(filename, module_globals)
    13291332
    13301333    def run(self, test, compileflags=None, out=None, clear_globs=True):
    13311334        """
Back to Top