Add mig.shared.compat with its first entrant of ensure_native_string() #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A case was identified in force_native_str that triggers divergent behaviour between python versions; arrange a behaviourally consistent version of this function that uniformly produces the UnicodeDecodeError in such a case and capture this as a test.
Such functions are intended to be transitional, thus a place to centrally collect them will ease their identification and removal at a later point.
The added function is intended to replace users of force_native_str which is often used to wrap, for example, substitutions of values into strings that are defined in the source code. In Python 3 these are mandated to be UTF-8, and thus "utf8" is what Python 3 will attempt to decode. It is on this basis that this encoding is hard-coded in the call. While most callsites appear clean in this regard, swapping to the new function is not guaranteed to be , thus prefer to switch callsites over piecemeal as they are audited and test covered one by one as opposed to a blanket switchover.