[Python-checkins] r68540 - in python/trunk: Misc/NEWS Python/sysmodule.c
martin.v.loewis
python-checkins at python.org
Mon Jan 12 08:57:11 CET 2009
Author: martin.v.loewis
Date: Mon Jan 12 08:57:11 2009
New Revision: 68540
Log:
Issue #4915: Port sysmodule to Windows CE.
Modified:
python/trunk/Misc/NEWS
python/trunk/Python/sysmodule.c
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Mon Jan 12 08:57:11 2009
@@ -12,6 +12,8 @@
Core and Builtins
-----------------
+- Issue #4915: Port sysmodule to Windows CE.
+
- Issue #4074: Change the criteria for doing a full garbage collection (i.e.
collecting the oldest generation) so that allocating lots of objects without
destroying them does not show quadratic performance. Based on a proposal by
Modified: python/trunk/Python/sysmodule.c
==============================================================================
--- python/trunk/Python/sysmodule.c (original)
+++ python/trunk/Python/sysmodule.c Mon Jan 12 08:57:11 2009
@@ -1296,8 +1296,13 @@
PyDict_SetItemString(sysdict, key, v); \
Py_XDECREF(v)
+ /* Check that stdin is not a directory
+ Using shell redirection, you can redirect stdin to a directory,
+ crashing the Python interpreter. Catch this common mistake here
+ and output a useful error message. Note that under MS Windows,
+ the shell already prevents that. */
+#if !defined(MS_WINDOWS)
{
- /* XXX: does this work on Win/Win64? (see posix_fstat) */
struct stat sb;
if (fstat(fileno(stdin), &sb) == 0 &&
S_ISDIR(sb.st_mode)) {
@@ -1307,6 +1312,7 @@
exit(EXIT_FAILURE);
}
}
+#endif
/* Closing the standard FILE* if sys.std* goes aways causes problems
* for embedded Python usages. Closing them when somebody explicitly
@@ -1526,7 +1532,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 +1577,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),
More information about the Python-checkins
mailing list