Index: Python/sysmodule.c =================================================================== --- Python/sysmodule.c (revision 68528) +++ Python/sysmodule.c (working copy) @@ -1297,10 +1297,20 @@ Py_XDECREF(v) { +#if defined(MS_WINCE) + /* CE doesn't have GetStdHandle(), take the ugly way through the + C library's _fileno() to get at the input handle. TODO: find out + how the C library got at the handle. */ + BY_HANDLE_FILE_INFORMATION fi; + if(GetFileInformationByHandle(_fileno(stdin), &fi) + && (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) +#else /* XXX: does this work on Win/Win64? (see posix_fstat) */ struct stat sb; if (fstat(fileno(stdin), &sb) == 0 && - S_ISDIR(sb.st_mode)) { + S_ISDIR(sb.st_mode)) +#endif + { /* There's nothing more we can do. */ /* Py_FatalError() will core dump, so just exit. */ PySys_WriteStderr("Python error: is a directory, cannot continue\n"); @@ -1526,7 +1536,7 @@ { #if defined(HAVE_REALPATH) char fullpath[MAXPATHLEN]; -#elif defined(MS_WINDOWS) +#elif defined(MS_WINDOWS) && !defined(MS_WINCE) char fullpath[MAX_PATH]; #endif PyObject *av = makeargvobject(argc, argv); @@ -1571,7 +1581,10 @@ #if SEP == '\\' /* Special case for MS filename syntax */ if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { char *q; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && !defined(MS_WINCE) + /* This code here replaces the first element in argv with the full + path that it represents. Under CE, there are no relative paths so + the argument must be the full path anyway. */ char *ptemp; if (GetFullPathName(argv0, sizeof(fullpath),