#1775 closed defect (fixed)

u"py3 not supported" idiom will break in Python 3.3

Reported by: davidsarah Owned by: davidsarah
Priority: normal Milestone: 1.10.0
Component: code Version: 1.9.1
Keywords: python3 error Cc:
Launchpad Bug:

Description (last modified by davidsarah)

setup.py and bin/tahoe-script.template currently use the following idiom near the top of each file to prevent them from producing even-more-confusing-than-necessary syntax errors when run in a Python 3.x interpreter:

u"Tahoe-LAFS does not run under Python 3. Please use a version of Python between 2.5 and 2.7.x inclusive."

This will break in Python 3.3 due to PEP 414, which adds the u"..." string syntax.

Change History (2)

comment:1 Changed at 2012-06-20T23:16:41Z by davidsarah

  • Description modified (diff)
  • Owner set to davidsarah
  • Status changed from new to assigned

comment:2 Changed at 2013-03-15T04:53:06Z by davidsarah

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in edfb40e5 and 3bdd744b.

Both of these files now have the line:

import sys; assert sys.version_info < (3,), ur"Tahoe-LAFS does not run under Python 3. Please use a version of Python between 2.5 and 2.7.x inclusive."

near the start.

If this is a syntax error (which it is on Python 3.0-3.3 inclusive due to the ur"..."), then the resulting error will include the desired message.

Otherwise, provided there are no other Python 3 syntax errors (which there are not, due to the other changes in these patches), this code will still fail and print the message due to the assertion. That would happen if some future Python version added ur"...", for example.

Note: See TracTickets for help on using tickets.