Michael Saah <mike.s...@gmail.com> added the comment:
Hi Victor, thanks for taking a look. > Would why datetime have the same behavior on all platforms, but > time.strftime('%') may or may not raise an exception depending on the libc? If I understand the call stack correctly, datetime does not have the same behavior on all platforms. datetime does some preprocessing and then hands the resulting format string down to time.strftime, which in turn passes it down to the system. The time module does not check for trailing %. To be honest, I can't claim to understand the strftime system-dependence, as I couldn't find good documentation of it nor could I find error handling code. The C version of datetime.strftime really just said "There's a lone trailing %; doesn't make sense." when making the check. The python version of datetime did not make this check, and neither does any version of the time module's strftime. > Something similar can be done for the trailing "%": pass a substring (without > the trailing %) to strftime() / wcsftime(), and later append "%". I like this idea, as it gets around the ill-defined parameters of system-dependence that I'm working with. This change would need to made to the time module, and would be in addition to the changes I've already made. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35066> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com