[tahoe-lafs-trac-stream] [tahoe-lafs] #1775: u"py3 not supported" idiom will break in Python 3.3
tahoe-lafs
trac at tahoe-lafs.org
Fri Mar 15 04:53:47 UTC 2013
#1775: u"py3 not supported" idiom will break in Python 3.3
----------------------------+---------------------------
Reporter: davidsarah | Owner: davidsarah
Type: defect | Status: closed
Priority: normal | Milestone: 1.10.0
Component: code | Version: 1.9.1
Resolution: fixed | Keywords: python3 error
Launchpad Bug: |
----------------------------+---------------------------
Changes (by davidsarah):
* status: assigned => closed
* resolution: => fixed
Old description:
> [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
> [http://www.python.org/dev/peps/pep-0414/ PEP 414], which adds the
> {{{u"..."}}} string syntax.
New description:
[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
[http://www.python.org/dev/peps/pep-0414/ PEP 414], which adds the
{{{u"..."}}} string syntax.
--
Comment:
Fixed in [https://github.com/tahoe-lafs/tahoe-
lafs/commit/edfb40e57c30fcac2d85be3f298d5c1f080322dd edfb40e5] and
[https://github.com/tahoe-lafs/tahoe-
lafs/commit/3bdd744b8e39b657b8de468b2163eec84d87a134 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.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1775#comment:2>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list