This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mjsaah
Recipients belopolsky, eric.smith, matrixise, mjsaah, p-ganssle, pablogsal, terry.reedy, thatiparthy, vstinner, xtreak
Date 2019-01-09.17:13:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAAGJmtR-G9DgXy5cWdVVx0tAYzv=0Z6TAy5KRhUVqzpZK2Jz1g@mail.gmail.com>
In-reply-to <1547051946.05.0.551324776747.issue35066@roundup.psfhosted.org>
Content
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.
History
Date User Action Args
2019-01-09 17:13:56mjsaahsetrecipients: + mjsaah, terry.reedy, belopolsky, vstinner, eric.smith, matrixise, thatiparthy, p-ganssle, pablogsal, xtreak
2019-01-09 17:13:55mjsaahlinkissue35066 messages
2019-01-09 17:13:55mjsaahcreate