Should enforce using six.text_type() over unicode()

Bug #1257091 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hacking
Opinion
Wishlist
Unassigned

Bug Description

Given http://docs.python.org/3.0/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit, and there were some patches in nova recently to convert instances of unicode() to six.text_type(), it seems we should have a hacking rule that enforces the usage of six.text_type rather than unicode unless we're going to use 2to3, which I don't think we are.

Revision history for this message
Matt Riedemann (mriedem) wrote :

This is the related nova change I was thinking of, not for unicode() -> six.text_type() but it is basestring -> six.string_types:

https://review.openstack.org/#/c/53799/

Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Joe Gordon (jogo) wrote :

I'm not very keen on making hacking a python3 compatibility tool. That sounds like it should be separate.

Changed in hacking:
status: New → Opinion
importance: Undecided → Wishlist
Revision history for this message
Ian Cordasco (icordasc) wrote :

This would be great for an optional check that people could enable themselves. Are you still interested in this Matt?

Revision history for this message
Matt Riedemann (mriedem) wrote :

Wow I opened this a long time ago.

Victor Stinner is running through the projects, at least nova, and making them py34 compatible using six, and then he's adding a non-voting check queue py34 job when they are done, so that covers part of this already, just not with a hacking check, you'd hit py34 test failures if something isn't correct, which kind of sucks for those of us w/o a py34 environment for testing.

Anyway, I wouldn't be opposed to something here, but this might not be really necessary anymore.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.