Opened 13 years ago

Closed 13 years ago

#18269 closed Cleanup/optimization (fixed)

From __future__ import unicode_literals

Reported by: Claude Paroz Owned by: nobody
Component: Python 3 Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

To the road to Python3, a possible next step would be to use the from __future__ import unicode_literals and remove the u'' prefixes, as it is not supported in Python3 (may be added in 3.3 for compatibility reasons).

I made a branch which has strong inspiration from Vinay Sajip Python3 branch of Django (https://bitbucket.org/vinay.sajip/django):
https://github.com/claudep/django/tree/unicode_literals

Change History (10)

comment:2 by Claude Paroz, 13 years ago

I know about PEP 414, however we must decide if we want to support 3.2 or not...

comment:3 by anonymous, 13 years ago

I thought that decision had bee made, in favor of supporting 3.2. In this message: http://groups.google.com/group/django-developers/msg/49572ac23eb3267f from Carl Meyer:

I think the fact that the next Ubuntu LTS will include Python 3.2, and
it won't be possible to make use of PEP 314 on Python 3.2 without
install-time-transformation hacks, is a strong argument in favor of
sticking with a working unicode_literals port rather than reworking it
to use PEP 314.

I do not see any follow-up disagreeing with that position.

comment:4 by Karen Tracey, 13 years ago

Comment #3 was me.

comment:5 by Aymeric Augustin, 13 years ago

If I understand correctly (far from granted in this area):

  • if we only support 3.3+, we can use u"" and b"" for unicode and bytes (resp.)
  • to support 3.2, we have to use "" and b""

This doesn't make a big difference, so I agree with Karen and Carl that we should support 3.2.

I suppose automatic tools exist to help the conversion?

in reply to:  5 comment:6 by Claude Paroz, 13 years ago

Replying to aaugustin:
(...)

I suppose automatic tools exist to help the conversion?

The conversion is already done (more or less automatically) in my branch (see link in the description).

comment:7 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

comment:8 by Claude Paroz <claude@…>, 13 years ago

In [38408f8007eae21b9f1cbbcc7f86d4b2042ff86a]:

Marked bytestrings with b prefix. Refs #18269

This is a preparation for unicode literals general usage in
Django (Python 3 compatibility).

comment:9 by Claude Paroz, 13 years ago

I just updated the branch (rebased) and created a pull request for better review: https://github.com/django/django/pull/86

comment:10 by Claude Paroz <claude@…>, 13 years ago

Resolution: fixed
Status: newclosed

In [4a103086d5c67fa4fcc53c106c9fdf644c742dd8]:

Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.

Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.

Note: See TracTickets for help on using tickets.
Back to Top