Edgewall Software

Opened 11 years ago

Last modified 11 years ago

#540 closed defect

Upstream change in Python breaks genshi test suite — at Initial Version

Reported by: robie.basak@… Owned by: cmlenz
Priority: major Milestone: 0.7
Component: General Version: 0.6
Keywords: Cc:

Description

The genshi test suite gets stuck in an infinite loop when run against the latest upstream 2.7 branch.

Python issue http://bugs.python.org/issue16152 now has a fix that is committed to the 2.7 branch. This changes the definition of tokenize.PseudoToken. This constant is used in genshi.template.interpolation. The change to this constant causes the test genshi.template.tests.interpolation.py InterpolateTestCase.test_interpolate_full_mismatched_brackets to end up in an infinite loop.

A test case that demonstrates the problem is below. It fails on a build of Python 2.7 from the Python upstream 2.7 hg branch.

The current Ubuntu development release is based on the Python upstream 2.7 hg branch, so this causes genshi to fail to build on Ubuntu.

This affects both your 0.6 release and your svn trunk (r1209).

A workaround is to hardcode a local definition of PseudoToken as it was in previous Python versions. But it isn't clear to me if this is an acceptable fix. Please could you provide some guidance on what should be going on here, and how we might patch Ubuntu so that we can build genshi?

Steps to reproduce:

  1. Install Python 2.7 from Python upstream hg branch 2.7, or use the current Ubuntu development release (Raring).
  2. python setup.py build
  3. python setup.py test

Expected result: test suite should complete

Actual result: test suite hangs on test_interpolate_full_mismatched_brackets

Test case:

#!/usr/bin/python

import re
import unittest

from tokenize import PseudoToken

token_re = re.compile('%s|%s(?s)' % (
    r'[uU]?[rR]?("""|\'\'\')((?<!\\)\\\1|.)*?\1',
    PseudoToken
))

class TestCase(unittest.TestCase):
    def test_regexp_does_not_match(self):
        self.assertEqual(token_re.match('${{1:2}', 7), None)

if __name__ == '__main__':
    unittest.main()

Change History (0)

Note: See TracTickets for help on using tickets.