diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-31 14:31:45 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-31 14:31:45 (GMT) |
commit | 7b3ce6a17ea70e2acec46122e134097ce03d044a (patch) | |
tree | 51c11d64bc07786b0e1f9d5a8aaf8336a62a8d66 /Python | |
parent | 4b8db419c278215ac1c79f4aac2b1453b13e8c83 (diff) | |
download | cpython-7b3ce6a17ea70e2acec46122e134097ce03d044a.zip cpython-7b3ce6a17ea70e2acec46122e134097ce03d044a.tar.gz cpython-7b3ce6a17ea70e2acec46122e134097ce03d044a.tar.bz2 |
Merged revisions 60441-60474 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60441 | christian.heimes | 2008-01-30 12:46:00 +0100 (Wed, 30 Jan 2008) | 1 line
Removed unused var
........
r60448 | christian.heimes | 2008-01-30 18:21:22 +0100 (Wed, 30 Jan 2008) | 1 line
Fixed some references leaks in sys.
........
r60450 | christian.heimes | 2008-01-30 19:58:29 +0100 (Wed, 30 Jan 2008) | 1 line
The previous change was causing a segfault after multiple calls to Py_Initialize() and Py_Finalize().
........
r60463 | raymond.hettinger | 2008-01-30 23:17:31 +0100 (Wed, 30 Jan 2008) | 1 line
Update itertool recipes
........
r60464 | christian.heimes | 2008-01-30 23:54:18 +0100 (Wed, 30 Jan 2008) | 1 line
Bug #1234: Fixed semaphore errors on AIX 5.2
........
r60469 | raymond.hettinger | 2008-01-31 02:38:15 +0100 (Thu, 31 Jan 2008) | 6 lines
Fix defect in __ixor__ which would get the wrong
answer if the input iterable had a duplicate element
(two calls to toggle() reverse each other). Borrow
the correct code from sets.py.
........
r60470 | raymond.hettinger | 2008-01-31 02:42:11 +0100 (Thu, 31 Jan 2008) | 1 line
Missing return
........
r60471 | jeffrey.yasskin | 2008-01-31 08:44:11 +0100 (Thu, 31 Jan 2008) | 4 lines
Added more documentation on how mixed-mode arithmetic should be implemented. I
also noticed and fixed a bug in Rational's forward operators (they were
claiming all instances of numbers.Rational instead of just the concrete types).
........
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 2 | ||||
-rw-r--r-- | Python/marshal.c | 2 | ||||
-rw-r--r-- | Python/sysmodule.c | 41 |
3 files changed, 21 insertions, 24 deletions
diff --git a/Python/import.c b/Python/import.c index cce854f..77fe168 100644 --- a/Python/import.c +++ b/Python/import.c @@ -371,6 +371,8 @@ static char* sys_deletes[] = { "path", "argv", "ps1", "ps2", "last_type", "last_value", "last_traceback", "path_hooks", "path_importer_cache", "meta_path", + /* misc stuff */ + "flags", "float_info", NULL }; diff --git a/Python/marshal.c b/Python/marshal.c index 4c0f088..175ac0e 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -482,7 +482,7 @@ r_object(RFILE *p) { /* NULL is a valid return value, it does not necessarily means that an exception is set. */ - PyObject *v, *v2, *v3; + PyObject *v, *v2; long i, n; int type = r_byte(p); PyObject *retval; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e536f0a..d3ec827 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1131,8 +1131,6 @@ make_flags(void) if (PyErr_Occurred()) { return NULL; } - - Py_INCREF(seq); return seq; } @@ -1146,6 +1144,11 @@ _PySys_Init(void) if (m == NULL) return NULL; sysdict = PyModule_GetDict(m); +#define SET_SYS_FROM_STRING(key, value) \ + v = value; \ + if (v != NULL) \ + PyDict_SetItemString(sysdict, key, v); \ + Py_XDECREF(v) { /* XXX: does this work on Win/Win64? (see posix_fstat) */ @@ -1165,19 +1168,16 @@ _PySys_Init(void) PyDict_GetItemString(sysdict, "displayhook")); PyDict_SetItemString(sysdict, "__excepthook__", PyDict_GetItemString(sysdict, "excepthook")); - PyDict_SetItemString(sysdict, "version", - v = PyUnicode_FromString(Py_GetVersion())); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "hexversion", - v = PyLong_FromLong(PY_VERSION_HEX)); - Py_XDECREF(v); + SET_SYS_FROM_STRING("version", + PyUnicode_FromString(Py_GetVersion())); + SET_SYS_FROM_STRING("hexversion", + PyLong_FromLong(PY_VERSION_HEX)); svnversion_init(); - v = Py_BuildValue("(UUU)", "CPython", branch, svn_revision); - PyDict_SetItemString(sysdict, "subversion", v); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "dont_write_bytecode", - v = PyBool_FromLong(Py_DontWriteBytecodeFlag)); - Py_XDECREF(v); + SET_SYS_FROM_STRING("subversion", + Py_BuildValue("(UUU)", "CPython", branch, + svn_revision)); + SET_SYS_FROM_STRING("dont_write_bytecode", + PyBool_FromLong(Py_DontWriteBytecodeFlag)); /* * These release level checks are mutually exclusive and cover * the field, so don't get too fancy with the pre-processor! @@ -1192,12 +1192,6 @@ _PySys_Init(void) s = "final"; #endif -#define SET_SYS_FROM_STRING(key, value) \ - v = value; \ - if (v != NULL) \ - PyDict_SetItemString(sysdict, key, v); \ - Py_XDECREF(v) - SET_SYS_FROM_STRING("version_info", Py_BuildValue("iiiUi", PY_MAJOR_VERSION, PY_MINOR_VERSION, @@ -1244,7 +1238,6 @@ _PySys_Init(void) SET_SYS_FROM_STRING("winver", PyUnicode_FromString(PyWin_DLLVersionString)); #endif -#undef SET_SYS_FROM_STRING if (warnoptions == NULL) { warnoptions = PyList_New(0); } @@ -1255,12 +1248,14 @@ _PySys_Init(void) PyDict_SetItemString(sysdict, "warnoptions", warnoptions); } - PyStructSequence_InitType(&FlagsType, &flags_desc); - PyDict_SetItemString(sysdict, "flags", make_flags()); + if (FlagsType.tp_name == 0) + PyStructSequence_InitType(&FlagsType, &flags_desc); + SET_SYS_FROM_STRING("flags", make_flags()); /* prevent user from creating new instances */ FlagsType.tp_init = NULL; FlagsType.tp_new = NULL; +#undef SET_SYS_FROM_STRING if (PyErr_Occurred()) return NULL; return m; |