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

Closed
opened 2012-06-20 23:16:24 +00:00 by davidsarah · 1 comment
davidsarah commented 2012-06-20 23:16:24 +00:00
Owner

source:setup.py and source: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.

source:setup.py and source: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](http://www.python.org/dev/peps/pep-0414/), which adds the `u"..."` string syntax.
tahoe-lafs added the
code
normal
defect
1.9.1
labels 2012-06-20 23:16:24 +00:00
tahoe-lafs added this to the 1.10.0 milestone 2012-06-20 23:16:24 +00:00
davidsarah commented 2013-03-15 04:53:06 +00:00
Author
Owner

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.

Fixed in [edfb40e5](https://github.com/tahoe-lafs/tahoe-lafs/commit/edfb40e57c30fcac2d85be3f298d5c1f080322dd) and [3bdd744b](https://github.com/tahoe-lafs/tahoe-lafs/commit/3bdd744b8e39b657b8de468b2163eec84d87a134). 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.
tahoe-lafs added the
fixed
label 2013-03-15 04:53:06 +00:00
davidsarah closed this issue 2013-03-15 04:53:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tahoe-lafs/trac-2024-07-25#1775
No description provided.