os.stat() crashes on Win32

Jason Orendorff jason at jorendorff.com
Tue Dec 18 18:27:50 CET 2001


I just grabbed the latest out of CVS, built it using VC6, and tried
to run python_d.exe.  It bails out (a memory-management assertion fails)
while running site.py.

site.py calls os.path.isdir(), which calls os.stat(), which calls
the C function posix_do_stat() in Modules/posixmodule.c
(lines 677-725).  In my case, it is being called with the argument
"C:\\Program Files\\ActivePython22\\Pythonwin\\" (this, including
the trailing backslash, is due to a registry setting).

The result:

    char *path = NULL;
    char pathcopy[MAX_PATH];
    ...
    /* populate 'path' using PyArg_ParseTuple(), line 690 */
    ...
    path = pathcopy;  // line 712
    ...
    PyMem_Free(path);  // line 723

It appears to be a bug in posixmodule.c.  The bug is only enabled
on MS_WIN32, thanks to some #ifdef's in the code.

What's going on here?  Why doesn't this cause crashes in the
binary distribution of Python 2.2c1?  Am I building it wrong?

-- 
Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list