Switch away from text_type shims.

Review Request #11854 — Created Oct. 15, 2021 and submitted

Information

Review Board
master

Reviewers

In the Python 2 to 3 conversion, the name of the binary type was changed
from str to bytes, and the name of the string type was changed from
unicode to str. In addition, there were some other changes such as
the removal of the basestring type. The six library included a bunch
of helpers to ease this transition. Now that we're Python 3+ only on the
master branch, we can get rid of these and just use the builtins.

Ran unit tests.

Summary ID
Switch away from text_type shims.
In the Python 2 to 3 conversion, the name of the binary type was changed from `str` to `bytes`, and the name of the string type was changed from `unicode` to `str`. In addition, there were some other changes such as the removal of the `basestring` type. The `six` library included a bunch of helpers to ease this transition. Now that we're Python 3+ only on the master branch, we can get rid of these and just use the builtins. Testing Done: Ran unit tests.
d56c52cda00badbd1d7f1f1cb7ffcdae0e4d2343
Description From Last Updated

W504 line break after binary operator

reviewbotreviewbot

W504 line break after binary operator

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
  1. The code looks fine, but I want to discuss where changes like this should land, and an approach for the 5.0 release.

    We'll likely need to maintain 4 and 5 for a while (given how hard it'll be to move customers off of Python 2.7), both merging changes from 4 to 5 and backporting changes from 5 to 4. That'll be easier if we don't drop or convert too much code to Python 3-only.

    So I'm thinking:

    1. We create a release-5.0.x branch, keep it focused on the Django 1.11 port and features we want to land, but avoid too much code churn (like dropping six usage).
    2. We then finish the move with bigger, wider-reaching changes like this on master, targetting 6.0.

    That should be enough of a transition time to get people from 4 to 5, making it safer to backport/merge changes, since we won't need to worry about things like str() doing the wrong thing accidentally.

    What do you think of that plan?

    1. I'm fine with that plan, but I don't know that anything saves us from pain during merges/backports. Until we jettison Python 2, we'll always just have to be careful no matter which branches things happen on.

  2. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (865559b)