[issue6608] asctime causing python to crash
report at bugs.python.org
Sat Aug 1 06:00:40 CEST 2009
James Abbatiello <abbeyj at gmail.com> added the comment:
Since there's no good way to disable the assertion (see issue4804),
checking the validity of the argument beforehand looks like an option.
The checking that's currently being done in the strftime()
implementation looks useful but it is not enough. The checking in the
MS implementation of asctime() is very strict and validates the entire
date, not just one field at a time. So there's no way to print out
non-existant dates like (2009, 2, 31, 0, 0, 0, 0, 0, 0) -> 'Mon Feb 31
I don't know if anybody is relying on that kind of behavior. If not
then the function could be limited to accept only valid dates.
Alternatively we could just not call down to asctime() but instead
provide our own implementation using sprintf/strftime.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list