comparison Python/sysmodule.c @ 50788:e11c99e1e6e7 2.6

Merged revisions 68521,68527,68534-68536,68540,68547,68552,68563,68570,68572,68575,68579-68580,68584 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r68521 | hirokazu.yamamoto | 2009-01-11 04:28:13 +0100 (So, 11 Jan 2009) | 1 line Fixed version number in build_ssl.bat. ........ r68527 | martin.v.loewis | 2009-01-11 10:43:55 +0100 (So, 11 Jan 2009) | 2 lines Issue #4895: Use _strdup on Windows CE. ........ r68534 | gregory.p.smith | 2009-01-11 18:53:33 +0100 (So, 11 Jan 2009) | 2 lines correct email address ........ r68535 | gregory.p.smith | 2009-01-11 18:57:54 +0100 (So, 11 Jan 2009) | 9 lines Update the documentation for binascii and zlib crc32/adler32 functions to better describe the signed vs unsigned return value behavior on different platforms and versions of python. Mention the workaround to make them all return the same thing by using & 0xffffffff. Fixes issue4903. Also needs to be merged into release26-maint, release30-maint, & py3k. ........ r68536 | benjamin.peterson | 2009-01-11 20:48:15 +0100 (So, 11 Jan 2009) | 1 line add email addresses ........ r68540 | martin.v.loewis | 2009-01-12 08:57:11 +0100 (Mo, 12 Jan 2009) | 2 lines Issue #4915: Port sysmodule to Windows CE. ........ r68547 | kristjan.jonsson | 2009-01-12 19:09:27 +0100 (Mo, 12 Jan 2009) | 1 line Add tests for invalid format specifiers in strftime, and for handling of invalid file descriptors in the os module. ........ r68552 | vinay.sajip | 2009-01-12 21:36:18 +0100 (Mo, 12 Jan 2009) | 1 line Minor changes/corrections in markup. ........ r68563 | benjamin.peterson | 2009-01-13 02:49:10 +0100 (Di, 13 Jan 2009) | 1 line small logic correction ........ r68570 | raymond.hettinger | 2009-01-13 10:08:32 +0100 (Di, 13 Jan 2009) | 5 lines Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard(). Needs to be backported to 2.6 and forward ported to 3.0 and 3.1. ........ r68572 | andrew.kuchling | 2009-01-13 14:40:54 +0100 (Di, 13 Jan 2009) | 1 line Note that first coord. is left alone ........ r68575 | thomas.heller | 2009-01-13 18:32:28 +0100 (Di, 13 Jan 2009) | 1 line Fix refcount leak in error cases. Bug found by coverity. ........ r68579 | benjamin.peterson | 2009-01-13 22:42:23 +0100 (Di, 13 Jan 2009) | 1 line make bytearrayobject.o depend on the stringlib #4936 ........ r68580 | benjamin.peterson | 2009-01-13 22:43:11 +0100 (Di, 13 Jan 2009) | 1 line add bytearrayobject.h to PYTHON_HEADERS ........ r68584 | benjamin.peterson | 2009-01-13 23:22:41 +0100 (Di, 13 Jan 2009) | 1 line de-spacify ........
author Georg Brandl <georg@python.org>
date Wed, 14 Jan 2009 00:08:09 +0000
parents fd054e73e2f2
children e17c18a6caec e239e977bb32
comparison
equal deleted inserted replaced
50787:0ef1e664a4a4 50788:e11c99e1e6e7
1294 v = value; \ 1294 v = value; \
1295 if (v != NULL) \ 1295 if (v != NULL) \
1296 PyDict_SetItemString(sysdict, key, v); \ 1296 PyDict_SetItemString(sysdict, key, v); \
1297 Py_XDECREF(v) 1297 Py_XDECREF(v)
1298 1298
1299 /* Check that stdin is not a directory
1300 Using shell redirection, you can redirect stdin to a directory,
1301 crashing the Python interpreter. Catch this common mistake here
1302 and output a useful error message. Note that under MS Windows,
1303 the shell already prevents that. */
1304 #if !defined(MS_WINDOWS)
1299 { 1305 {
1300 /* XXX: does this work on Win/Win64? (see posix_fstat) */
1301 struct stat sb; 1306 struct stat sb;
1302 if (fstat(fileno(stdin), &sb) == 0 && 1307 if (fstat(fileno(stdin), &sb) == 0 &&
1303 S_ISDIR(sb.st_mode)) { 1308 S_ISDIR(sb.st_mode)) {
1304 /* There's nothing more we can do. */ 1309 /* There's nothing more we can do. */
1305 /* Py_FatalError() will core dump, so just exit. */ 1310 /* Py_FatalError() will core dump, so just exit. */
1306 PySys_WriteStderr("Python error: <stdin> is a directory, cannot continue\n"); 1311 PySys_WriteStderr("Python error: <stdin> is a directory, cannot continue\n");
1307 exit(EXIT_FAILURE); 1312 exit(EXIT_FAILURE);
1308 } 1313 }
1309 } 1314 }
1315 #endif
1310 1316
1311 /* Closing the standard FILE* if sys.std* goes aways causes problems 1317 /* Closing the standard FILE* if sys.std* goes aways causes problems
1312 * for embedded Python usages. Closing them when somebody explicitly 1318 * for embedded Python usages. Closing them when somebody explicitly
1313 * invokes .close() might be possible, but the FAQ promises they get 1319 * invokes .close() might be possible, but the FAQ promises they get
1314 * never closed. However, we still need to get write errors when 1320 * never closed. However, we still need to get write errors when
1524 void 1530 void
1525 PySys_SetArgv(int argc, char **argv) 1531 PySys_SetArgv(int argc, char **argv)
1526 { 1532 {
1527 #if defined(HAVE_REALPATH) 1533 #if defined(HAVE_REALPATH)
1528 char fullpath[MAXPATHLEN]; 1534 char fullpath[MAXPATHLEN];
1529 #elif defined(MS_WINDOWS) 1535 #elif defined(MS_WINDOWS) && !defined(MS_WINCE)
1530 char fullpath[MAX_PATH]; 1536 char fullpath[MAX_PATH];
1531 #endif 1537 #endif
1532 PyObject *av = makeargvobject(argc, argv); 1538 PyObject *av = makeargvobject(argc, argv);
1533 PyObject *path = PySys_GetObject("path"); 1539 PyObject *path = PySys_GetObject("path");
1534 if (av == NULL) 1540 if (av == NULL)
1569 } 1575 }
1570 #endif /* HAVE_READLINK */ 1576 #endif /* HAVE_READLINK */
1571 #if SEP == '\\' /* Special case for MS filename syntax */ 1577 #if SEP == '\\' /* Special case for MS filename syntax */
1572 if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { 1578 if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
1573 char *q; 1579 char *q;
1574 #ifdef MS_WINDOWS 1580 #if defined(MS_WINDOWS) && !defined(MS_WINCE)
1581 /* This code here replaces the first element in argv with the full
1582 path that it represents. Under CE, there are no relative paths so
1583 the argument must be the full path anyway. */
1575 char *ptemp; 1584 char *ptemp;
1576 if (GetFullPathName(argv0, 1585 if (GetFullPathName(argv0,
1577 sizeof(fullpath), 1586 sizeof(fullpath),
1578 fullpath, 1587 fullpath,
1579 &ptemp)) { 1588 &ptemp)) {