[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

Alexey Izbyshev report at bugs.python.org
Thu Aug 30 19:10:49 EDT 2018


Alexey Izbyshev <izbyshev at ispras.ru> added the comment:

> if we can't make assertions about the behavior of strftime outputs, I think it makes it hard to prevent regressions.

Ironically, some of the changes we may have to make to fix time.strftime() inconsistencies may appear like regressions to some users. For example, regarding dropping wcsftime() on all platforms, 'man strftime' on macOS contains the following warning in BUGS section: "The strftime() function does not correctly handle multibyte characters in the format argument.". (I'm not sure what "incorrect handling" means here). That's not to discourage you, just to point out that we should be extra careful at this point when there might be users relying on every variety of the current behavior. And that's also why I don't want to mix the fix for C vs. Python issue (low risk) with changes in time.strftime() (high risk).

Also, while I certainly agree with "the outsized effort" point, it seems that your PR goes far beyond supporting surrogates because falling back to escaping allows one to bypass checks in wcsftime()/strftime() and round-trip any code point regardless of the current locale.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34481>
_______________________________________


More information about the Python-bugs-list mailing list