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

Paul Ganssle report at bugs.python.org
Wed Aug 29 12:04:00 EDT 2018


Paul Ganssle <p.ganssle at gmail.com> added the comment:

I'm finding it very difficult to reconcile these things. I'm not entirely sure, but we may need to take a performance hit in normal strftime if we want to make this work with surrogate characters, which really does not appeal to me (though we can certainly improve to some degree).

One major question here: Is anyone (@vstinner, @belopolsky?) know why time's strftime opportunistically uses wcsftime instead of strftime? It makes the code *way* more complicated and difficult to read / maintain - are there platforms that provide wcstrftime and not strftime?

Also, related, it seems according to https://bugs.python.org/issue10653#msg243660 that there may have been a regression in issue #10653, which may be related here.

Either way, some note should probably be made in the code to clarify exactly *why* these choices were made in the code, in case the situation has changed.

----------

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


More information about the Python-bugs-list mailing list