Skip to content

Add mig.shared.compat with its first entrant of ensure_native_string() #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

albu-diku
Copy link
Contributor

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.

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.
@albu-diku albu-diku force-pushed the addition/mig.shared.compat branch from 170852c to fbf4372 Compare June 17, 2024 11:30
@jonasbardino jonasbardino self-assigned this Jun 20, 2024
@jonasbardino jonasbardino added enhancement New feature or request unit test labels Jun 20, 2024
@jonasbardino
Copy link
Contributor

Looks good. I've manually merged through svn now with only minor PEP8 adjustments and typo fixes in comments and docstrings.

@albu-diku albu-diku deleted the addition/mig.shared.compat branch June 24, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants