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 tim.peters
Recipients
Date 2004-02-16.01:23:50
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435

I assume this is specific to Python on Windows using 
Microsoft's C, since this workalike plain C program also dies 
with a memory error while in the bowels of MS's strftime():

#include <stdio.h>
#include <time.h>

void main() {
    struct tm t;
    char buf[256];
    size_t i;

    t.tm_year = 1900 - 1900;
    t.tm_mon = 1 - 1;
    t.tm_mday = 1;
    t.tm_hour = 13;
    t.tm_min = 0;
    t.tm_sec = 0;
    t.tm_wday = -3;
    t.tm_yday = 0;
    t.tm_isdst = -1;

    printf("calling strftime\n");
    i = strftime(buf, sizeof(buf), "%a", &t);
    printf("i: %d\n", i);
}

The problem is the negative value for tm_wday.  MS strftime 
isn't defensive, and uses the negative tm_wday to index into 
nonsense memory.  Ironically, if C had defined the % operator 
in the sane way (meaning Python's way <wink>), a negative 
tm_wday wouldn't have survived for the C library function to 
see.
History
Date User Action Args
2007-08-23 14:19:53adminlinkissue897625 messages
2007-08-23 14:19:53admincreate