ucphhpc / migrid-sync

MiGrid workspace where master branch is kept strictly in sync with SF upstream svn repo. Any development or experiments should use a branch. You probably want to fork your own clone or work e.g. on the edge branch if you wish to contribute.
GNU General Public License v2.0
3 stars 3 forks source link

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

Closed albu-diku closed 4 weeks ago

albu-diku commented 1 month ago

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 commented 1 month ago

@jonasbardino updated with the"utf8" rationale in both commit message and clear comment

albu-diku commented 4 weeks ago

Replaced by https://github.com/ucphhpc/migrid-sync/pull/64.