comparison Python/sysmodule.c @ 41981:c6a0b75dbec2

Change most sys attributes that were str8 objects into str objects (executable, prefix and exec_prefix are still str8).
author Walter Dörwald <walter@livinglogic.de>
date Thu, 07 Jun 2007 18:41:59 +0000
parents 9d02a4adf574
children cd125fe83051
comparison
equal deleted inserted replaced
41980:827ec7680199 41981:c6a0b75dbec2
1047 PyDict_SetItemString(sysdict, "__displayhook__", 1047 PyDict_SetItemString(sysdict, "__displayhook__",
1048 PyDict_GetItemString(sysdict, "displayhook")); 1048 PyDict_GetItemString(sysdict, "displayhook"));
1049 PyDict_SetItemString(sysdict, "__excepthook__", 1049 PyDict_SetItemString(sysdict, "__excepthook__",
1050 PyDict_GetItemString(sysdict, "excepthook")); 1050 PyDict_GetItemString(sysdict, "excepthook"));
1051 PyDict_SetItemString(sysdict, "version", 1051 PyDict_SetItemString(sysdict, "version",
1052 v = PyString_FromString(Py_GetVersion())); 1052 v = PyUnicode_FromString(Py_GetVersion()));
1053 Py_XDECREF(v); 1053 Py_XDECREF(v);
1054 PyDict_SetItemString(sysdict, "hexversion", 1054 PyDict_SetItemString(sysdict, "hexversion",
1055 v = PyInt_FromLong(PY_VERSION_HEX)); 1055 v = PyInt_FromLong(PY_VERSION_HEX));
1056 Py_XDECREF(v); 1056 Py_XDECREF(v);
1057 svnversion_init(); 1057 svnversion_init();
1058 v = Py_BuildValue("(ssz)", "CPython", branch, svn_revision); 1058 v = Py_BuildValue("(UUU)", "CPython", branch, svn_revision);
1059 PyDict_SetItemString(sysdict, "subversion", v); 1059 PyDict_SetItemString(sysdict, "subversion", v);
1060 Py_XDECREF(v); 1060 Py_XDECREF(v);
1061 /* 1061 /*
1062 * These release level checks are mutually exclusive and cover 1062 * These release level checks are mutually exclusive and cover
1063 * the field, so don't get too fancy with the pre-processor! 1063 * the field, so don't get too fancy with the pre-processor!
1077 if (v != NULL) \ 1077 if (v != NULL) \
1078 PyDict_SetItemString(sysdict, key, v); \ 1078 PyDict_SetItemString(sysdict, key, v); \
1079 Py_XDECREF(v) 1079 Py_XDECREF(v)
1080 1080
1081 SET_SYS_FROM_STRING("version_info", 1081 SET_SYS_FROM_STRING("version_info",
1082 Py_BuildValue("iiisi", PY_MAJOR_VERSION, 1082 Py_BuildValue("iiiUi", PY_MAJOR_VERSION,
1083 PY_MINOR_VERSION, 1083 PY_MINOR_VERSION,
1084 PY_MICRO_VERSION, s, 1084 PY_MICRO_VERSION, s,
1085 PY_RELEASE_SERIAL)); 1085 PY_RELEASE_SERIAL));
1086 SET_SYS_FROM_STRING("api_version", 1086 SET_SYS_FROM_STRING("api_version",
1087 PyInt_FromLong(PYTHON_API_VERSION)); 1087 PyInt_FromLong(PYTHON_API_VERSION));
1088 SET_SYS_FROM_STRING("copyright", 1088 SET_SYS_FROM_STRING("copyright",
1089 PyString_FromString(Py_GetCopyright())); 1089 PyUnicode_FromString(Py_GetCopyright()));
1090 SET_SYS_FROM_STRING("platform", 1090 SET_SYS_FROM_STRING("platform",
1091 PyString_FromString(Py_GetPlatform())); 1091 PyUnicode_FromString(Py_GetPlatform()));
1092 SET_SYS_FROM_STRING("executable", 1092 SET_SYS_FROM_STRING("executable",
1093 PyString_FromString(Py_GetProgramFullPath())); 1093 PyString_FromString(Py_GetProgramFullPath()));
1094 SET_SYS_FROM_STRING("prefix", 1094 SET_SYS_FROM_STRING("prefix",
1095 PyString_FromString(Py_GetPrefix())); 1095 PyString_FromString(Py_GetPrefix()));
1096 SET_SYS_FROM_STRING("exec_prefix", 1096 SET_SYS_FROM_STRING("exec_prefix",
1111 if (s[0] == 0) 1111 if (s[0] == 0)
1112 value = "big"; 1112 value = "big";
1113 else 1113 else
1114 value = "little"; 1114 value = "little";
1115 SET_SYS_FROM_STRING("byteorder", 1115 SET_SYS_FROM_STRING("byteorder",
1116 PyString_FromString(value)); 1116 PyUnicode_FromString(value));
1117 } 1117 }
1118 #ifdef MS_COREDLL 1118 #ifdef MS_COREDLL
1119 SET_SYS_FROM_STRING("dllhandle", 1119 SET_SYS_FROM_STRING("dllhandle",
1120 PyLong_FromVoidPtr(PyWin_DLLhModule)); 1120 PyLong_FromVoidPtr(PyWin_DLLhModule));
1121 SET_SYS_FROM_STRING("winver", 1121 SET_SYS_FROM_STRING("winver",
1122 PyString_FromString(PyWin_DLLVersionString)); 1122 PyUnicode_FromString(PyWin_DLLVersionString));
1123 #endif 1123 #endif
1124 #undef SET_SYS_FROM_STRING 1124 #undef SET_SYS_FROM_STRING
1125 if (warnoptions == NULL) { 1125 if (warnoptions == NULL) {
1126 warnoptions = PyList_New(0); 1126 warnoptions = PyList_New(0);
1127 } 1127 }