[Python-bugs-list] [ python-Bugs-761337 ] datetime.strftime fails on trivial format string

SourceForge.net noreply@sourceforge.net
Thu, 26 Jun 2003 10:54:12 -0700


Bugs item #761337, was opened at 2003-06-26 11:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=761337&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason R. Coombs (jaraco)
Assigned to: Nobody/Anonymous (nobody)
Summary: datetime.strftime fails on trivial format string

Initial Comment:
Simply put, strftime can't handle the empty string.

>>> import datetime
>>> now = datetime.datetime.utcnow()
>>> now.strftime( '%d' )
'26'
>>> now.strftime( '' )
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
SystemError: C:\Code\23b1
\Objects\stringobject.c:3315: bad argument to internal 
function

This is inconsistent with the docs and the time.strftime 
function.

>>> import time
>>> time.strftime( '', time.gmtime() )
''

Do I need to make any more justification for having the 
empty format string return an empty string?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=761337&group_id=5470