ansible_mitogen: Some modules use `from __future__ import unicode_literals`
On Python 3 this has no effect. On Python 2 it is probably causing some subtle bugs. Particularly if there's a mix of Python 2 and Python 3 on controller and targets.
$ ag unicode_literal mitogen/ ansible_mitogen tests -l | sort
ansible_mitogen/_trace.py
ansible_mitogen/connection.py
ansible_mitogen/module_finder.py
ansible_mitogen/parsing.py
ansible_mitogen/planner.py
ansible_mitogen/plugins/action/mitogen_get_stack.py
ansible_mitogen/services.py
ansible_mitogen/transport_config.py
tests/ansible/lib/callback/nice_stdout.py
tests/data/importer/webproject/webapp/apps.py
tests/data/importer/webproject/webapp/models.py
To avoid confusion, we recommend using unicode_literals everywhere across a code-base or not at all, instead of turning on for only some modules.
-- https://python-future.org/unicode_literals.html
builtin:
myenum = type('Enum', (), enum)(slightly esotic) doesn't work with
unicode_literals:type()expects a string.
-- https://stackoverflow.com/questions/809796/any-gotchas-using-unicode-literals-in-python-2-6
I am beginning to think that
from __future__ import unicode_literalsdoes more harm than good. I don't recall exactly why we introduced it, but with the restoration ofu""literals in Python 3.3 we have a much better story for writing straddling code that is unicode-correct. ... I wonder if we can add an official note to the 2.7 docs recommending against it? -- GvR, https://mail.python.org/pipermail/python-dev/2016-December/147009.html