File: | ./Python/sysmodule.c |
Location: | line 1197, column 5 |
Description: | Value stored to 'r' is never read |
1 | |
2 | /* System module */ |
3 | |
4 | /* |
5 | Various bits of information used by the interpreter are collected in |
6 | module 'sys'. |
7 | Function member: |
8 | - exit(sts): raise SystemExit |
9 | Data members: |
10 | - stdin, stdout, stderr: standard file objects |
11 | - modules: the table of modules (dictionary) |
12 | - path: module search path (list of strings) |
13 | - argv: script arguments (list of strings) |
14 | - ps1, ps2: optional primary and secondary prompts (strings) |
15 | */ |
16 | |
17 | #include "Python.h" |
18 | #include "code.h" |
19 | #include "frameobject.h" |
20 | |
21 | #include "osdefs.h" |
22 | |
23 | #ifdef MS_WINDOWS |
24 | #define WIN32_LEAN_AND_MEAN |
25 | #include <windows.h> |
26 | #endif /* MS_WINDOWS */ |
27 | |
28 | #ifdef MS_COREDLL |
29 | extern void *PyWin_DLLhModule; |
30 | /* A string loaded from the DLL at startup: */ |
31 | extern const char *PyWin_DLLVersionString; |
32 | #endif |
33 | |
34 | #ifdef __VMS |
35 | #include <unixlib.h> |
36 | #endif |
37 | |
38 | #ifdef HAVE_LANGINFO_H1 |
39 | #include <locale.h> |
40 | #include <langinfo.h> |
41 | #endif |
42 | |
43 | PyObject * |
44 | PySys_GetObject(const char *name) |
45 | { |
46 | PyThreadState *tstate = PyThreadState_GET()PyThreadState_Get(); |
47 | PyObject *sd = tstate->interp->sysdict; |
48 | if (sd == NULL((void *)0)) |
49 | return NULL((void *)0); |
50 | return PyDict_GetItemString(sd, name); |
51 | } |
52 | |
53 | int |
54 | PySys_SetObject(const char *name, PyObject *v) |
55 | { |
56 | PyThreadState *tstate = PyThreadState_GET()PyThreadState_Get(); |
57 | PyObject *sd = tstate->interp->sysdict; |
58 | if (v == NULL((void *)0)) { |
59 | if (PyDict_GetItemString(sd, name) == NULL((void *)0)) |
60 | return 0; |
61 | else |
62 | return PyDict_DelItemString(sd, name); |
63 | } |
64 | else |
65 | return PyDict_SetItemString(sd, name, v); |
66 | } |
67 | |
68 | /* Write repr(o) to sys.stdout using sys.stdout.encoding and 'backslashreplace' |
69 | error handler. If sys.stdout has a buffer attribute, use |
70 | sys.stdout.buffer.write(encoded), otherwise redecode the string and use |
71 | sys.stdout.write(redecoded). |
72 | |
73 | Helper function for sys_displayhook(). */ |
74 | static int |
75 | sys_displayhook_unencodable(PyObject *outf, PyObject *o) |
76 | { |
77 | PyObject *stdout_encoding = NULL((void *)0); |
78 | PyObject *encoded, *escaped_str, *repr_str, *buffer, *result; |
79 | char *stdout_encoding_str; |
80 | int ret; |
81 | |
82 | stdout_encoding = PyObject_GetAttrString(outf, "encoding"); |
83 | if (stdout_encoding == NULL((void *)0)) |
84 | goto error; |
85 | stdout_encoding_str = _PyUnicode_AsString(stdout_encoding); |
86 | if (stdout_encoding_str == NULL((void *)0)) |
87 | goto error; |
88 | |
89 | repr_str = PyObject_Repr(o); |
90 | if (repr_str == NULL((void *)0)) |
91 | goto error; |
92 | encoded = PyUnicode_AsEncodedStringPyUnicodeUCS2_AsEncodedString(repr_str, |
93 | stdout_encoding_str, |
94 | "backslashreplace"); |
95 | Py_DECREF(repr_str)do { if (_Py_RefTotal-- , --((PyObject*)(repr_str))->ob_refcnt != 0) { if (((PyObject*)repr_str)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 95, (PyObject *)(repr_str)); } else _Py_Dealloc ((PyObject *)(repr_str)); } while (0); |
96 | if (encoded == NULL((void *)0)) |
97 | goto error; |
98 | |
99 | buffer = PyObject_GetAttrString(outf, "buffer"); |
100 | if (buffer) { |
101 | result = PyObject_CallMethod(buffer, "write", "(O)", encoded); |
102 | Py_DECREF(buffer)do { if (_Py_RefTotal-- , --((PyObject*)(buffer))->ob_refcnt != 0) { if (((PyObject*)buffer)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 102, (PyObject *)(buffer)); } else _Py_Dealloc ((PyObject *)(buffer)); } while (0); |
103 | Py_DECREF(encoded)do { if (_Py_RefTotal-- , --((PyObject*)(encoded))->ob_refcnt != 0) { if (((PyObject*)encoded)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 103, (PyObject *)(encoded)); } else _Py_Dealloc ((PyObject *)(encoded)); } while (0); |
104 | if (result == NULL((void *)0)) |
105 | goto error; |
106 | Py_DECREF(result)do { if (_Py_RefTotal-- , --((PyObject*)(result))->ob_refcnt != 0) { if (((PyObject*)result)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 106, (PyObject *)(result)); } else _Py_Dealloc ((PyObject *)(result)); } while (0); |
107 | } |
108 | else { |
109 | PyErr_Clear(); |
110 | escaped_str = PyUnicode_FromEncodedObjectPyUnicodeUCS2_FromEncodedObject(encoded, |
111 | stdout_encoding_str, |
112 | "strict"); |
113 | Py_DECREF(encoded)do { if (_Py_RefTotal-- , --((PyObject*)(encoded))->ob_refcnt != 0) { if (((PyObject*)encoded)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 113, (PyObject *)(encoded)); } else _Py_Dealloc ((PyObject *)(encoded)); } while (0); |
114 | if (PyFile_WriteObject(escaped_str, outf, Py_PRINT_RAW1) != 0) { |
115 | Py_DECREF(escaped_str)do { if (_Py_RefTotal-- , --((PyObject*)(escaped_str))->ob_refcnt != 0) { if (((PyObject*)escaped_str)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 115, (PyObject *)(escaped_str)); } else _Py_Dealloc((PyObject *)(escaped_str)); } while (0); |
116 | goto error; |
117 | } |
118 | Py_DECREF(escaped_str)do { if (_Py_RefTotal-- , --((PyObject*)(escaped_str))->ob_refcnt != 0) { if (((PyObject*)escaped_str)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 118, (PyObject *)(escaped_str)); } else _Py_Dealloc((PyObject *)(escaped_str)); } while (0); |
119 | } |
120 | ret = 0; |
121 | goto finally; |
122 | |
123 | error: |
124 | ret = -1; |
125 | finally: |
126 | Py_XDECREF(stdout_encoding)do { if ((stdout_encoding) == ((void *)0)) ; else do { if (_Py_RefTotal -- , --((PyObject*)(stdout_encoding))->ob_refcnt != 0) { if (((PyObject*)stdout_encoding)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 126, (PyObject *)(stdout_encoding)); } else _Py_Dealloc((PyObject *)(stdout_encoding)); } while ( 0); } while (0); |
127 | return ret; |
128 | } |
129 | |
130 | static PyObject * |
131 | sys_displayhook(PyObject *self, PyObject *o) |
132 | { |
133 | PyObject *outf; |
134 | PyInterpreterState *interp = PyThreadState_GET()PyThreadState_Get()->interp; |
135 | PyObject *modules = interp->modules; |
136 | PyObject *builtins = PyDict_GetItemString(modules, "builtins"); |
137 | int err; |
138 | |
139 | if (builtins == NULL((void *)0)) { |
140 | PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); |
141 | return NULL((void *)0); |
142 | } |
143 | |
144 | /* Print value except if None */ |
145 | /* After printing, also assign to '_' */ |
146 | /* Before, set '_' to None to avoid recursion */ |
147 | if (o == Py_None(&_Py_NoneStruct)) { |
148 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
149 | return Py_None(&_Py_NoneStruct); |
150 | } |
151 | if (PyObject_SetAttrString(builtins, "_", Py_None(&_Py_NoneStruct)) != 0) |
152 | return NULL((void *)0); |
153 | outf = PySys_GetObject("stdout"); |
154 | if (outf == NULL((void *)0) || outf == Py_None(&_Py_NoneStruct)) { |
155 | PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); |
156 | return NULL((void *)0); |
157 | } |
158 | if (PyFile_WriteObject(o, outf, 0) != 0) { |
159 | if (PyErr_ExceptionMatches(PyExc_UnicodeEncodeError)) { |
160 | /* repr(o) is not encodable to sys.stdout.encoding with |
161 | * sys.stdout.errors error handler (which is probably 'strict') */ |
162 | PyErr_Clear(); |
163 | err = sys_displayhook_unencodable(outf, o); |
164 | if (err) |
165 | return NULL((void *)0); |
166 | } |
167 | else { |
168 | return NULL((void *)0); |
169 | } |
170 | } |
171 | if (PyFile_WriteString("\n", outf) != 0) |
172 | return NULL((void *)0); |
173 | if (PyObject_SetAttrString(builtins, "_", o) != 0) |
174 | return NULL((void *)0); |
175 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
176 | return Py_None(&_Py_NoneStruct); |
177 | } |
178 | |
179 | PyDoc_STRVAR(displayhook_doc,static char displayhook_doc[] = "displayhook(object) -> None\n" "\n""Print an object to sys.stdout and also save it in builtins._\n" |
180 | "displayhook(object) -> None\n"static char displayhook_doc[] = "displayhook(object) -> None\n" "\n""Print an object to sys.stdout and also save it in builtins._\n" |
181 | "\n"static char displayhook_doc[] = "displayhook(object) -> None\n" "\n""Print an object to sys.stdout and also save it in builtins._\n" |
182 | "Print an object to sys.stdout and also save it in builtins._\n"static char displayhook_doc[] = "displayhook(object) -> None\n" "\n""Print an object to sys.stdout and also save it in builtins._\n" |
183 | )static char displayhook_doc[] = "displayhook(object) -> None\n" "\n""Print an object to sys.stdout and also save it in builtins._\n"; |
184 | |
185 | static PyObject * |
186 | sys_excepthook(PyObject* self, PyObject* args) |
187 | { |
188 | PyObject *exc, *value, *tb; |
189 | if (!PyArg_UnpackTuple(args, "excepthook", 3, 3, &exc, &value, &tb)) |
190 | return NULL((void *)0); |
191 | PyErr_Display(exc, value, tb); |
192 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
193 | return Py_None(&_Py_NoneStruct); |
194 | } |
195 | |
196 | PyDoc_STRVAR(excepthook_doc,static char excepthook_doc[] = "excepthook(exctype, value, traceback) -> None\n" "\n""Handle an exception by displaying it with a traceback on sys.stderr.\n" |
197 | "excepthook(exctype, value, traceback) -> None\n"static char excepthook_doc[] = "excepthook(exctype, value, traceback) -> None\n" "\n""Handle an exception by displaying it with a traceback on sys.stderr.\n" |
198 | "\n"static char excepthook_doc[] = "excepthook(exctype, value, traceback) -> None\n" "\n""Handle an exception by displaying it with a traceback on sys.stderr.\n" |
199 | "Handle an exception by displaying it with a traceback on sys.stderr.\n"static char excepthook_doc[] = "excepthook(exctype, value, traceback) -> None\n" "\n""Handle an exception by displaying it with a traceback on sys.stderr.\n" |
200 | )static char excepthook_doc[] = "excepthook(exctype, value, traceback) -> None\n" "\n""Handle an exception by displaying it with a traceback on sys.stderr.\n"; |
201 | |
202 | static PyObject * |
203 | sys_exc_info(PyObject *self, PyObject *noargs) |
204 | { |
205 | PyThreadState *tstate; |
206 | tstate = PyThreadState_GET()PyThreadState_Get(); |
207 | return Py_BuildValue( |
208 | "(OOO)", |
209 | tstate->exc_type != NULL((void *)0) ? tstate->exc_type : Py_None(&_Py_NoneStruct), |
210 | tstate->exc_value != NULL((void *)0) ? tstate->exc_value : Py_None(&_Py_NoneStruct), |
211 | tstate->exc_traceback != NULL((void *)0) ? |
212 | tstate->exc_traceback : Py_None(&_Py_NoneStruct)); |
213 | } |
214 | |
215 | PyDoc_STRVAR(exc_info_doc,static char exc_info_doc[] = "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." |
216 | "exc_info() -> (type, value, traceback)\n\static char exc_info_doc[] = "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." |
217 | \n\static char exc_info_doc[] = "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." |
218 | Return information about the most recent exception caught by an except\n\static char exc_info_doc[] = "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." |
219 | clause in the current stack frame or in an older stack frame."static char exc_info_doc[] = "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." |
220 | )static char exc_info_doc[] = "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame."; |
221 | |
222 | static PyObject * |
223 | sys_exit(PyObject *self, PyObject *args) |
224 | { |
225 | PyObject *exit_code = 0; |
226 | if (!PyArg_UnpackTuple(args, "exit", 0, 1, &exit_code)) |
227 | return NULL((void *)0); |
228 | /* Raise SystemExit so callers may catch it or clean up. */ |
229 | PyErr_SetObject(PyExc_SystemExit, exit_code); |
230 | return NULL((void *)0); |
231 | } |
232 | |
233 | PyDoc_STRVAR(exit_doc,static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
234 | "exit([status])\n\static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
235 | \n\static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
236 | Exit the interpreter by raising SystemExit(status).\n\static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
237 | If the status is omitted or None, it defaults to zero (i.e., success).\n\static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
238 | If the status is numeric, it will be used as the system exit status.\n\static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
239 | If it is another kind of object, it will be printed and the system\n\static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
240 | exit status will be one (i.e., failure)."static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." |
241 | )static char exit_doc[] = "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is numeric, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)."; |
242 | |
243 | |
244 | static PyObject * |
245 | sys_getdefaultencoding(PyObject *self) |
246 | { |
247 | return PyUnicode_FromStringPyUnicodeUCS2_FromString(PyUnicode_GetDefaultEncodingPyUnicodeUCS2_GetDefaultEncoding()); |
248 | } |
249 | |
250 | PyDoc_STRVAR(getdefaultencoding_doc,static char getdefaultencoding_doc[] = "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." |
251 | "getdefaultencoding() -> string\n\static char getdefaultencoding_doc[] = "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." |
252 | \n\static char getdefaultencoding_doc[] = "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." |
253 | Return the current default string encoding used by the Unicode \n\static char getdefaultencoding_doc[] = "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." |
254 | implementation."static char getdefaultencoding_doc[] = "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." |
255 | )static char getdefaultencoding_doc[] = "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation."; |
256 | |
257 | static PyObject * |
258 | sys_getfilesystemencoding(PyObject *self) |
259 | { |
260 | if (Py_FileSystemDefaultEncoding) |
261 | return PyUnicode_FromStringPyUnicodeUCS2_FromString(Py_FileSystemDefaultEncoding); |
262 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
263 | return Py_None(&_Py_NoneStruct); |
264 | } |
265 | |
266 | PyDoc_STRVAR(getfilesystemencoding_doc,static char getfilesystemencoding_doc[] = "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." |
267 | "getfilesystemencoding() -> string\n\static char getfilesystemencoding_doc[] = "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." |
268 | \n\static char getfilesystemencoding_doc[] = "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." |
269 | Return the encoding used to convert Unicode filenames in\n\static char getfilesystemencoding_doc[] = "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." |
270 | operating system filenames."static char getfilesystemencoding_doc[] = "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." |
271 | )static char getfilesystemencoding_doc[] = "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames."; |
272 | |
273 | static PyObject * |
274 | sys_intern(PyObject *self, PyObject *args) |
275 | { |
276 | PyObject *s; |
277 | if (!PyArg_ParseTuple(args, "U:intern", &s)) |
278 | return NULL((void *)0); |
279 | if (PyUnicode_CheckExact(s)((((PyObject*)(s))->ob_type) == &PyUnicode_Type)) { |
280 | Py_INCREF(s)( _Py_RefTotal++ , ((PyObject*)(s))->ob_refcnt++); |
281 | PyUnicode_InternInPlace(&s); |
282 | return s; |
283 | } |
284 | else { |
285 | PyErr_Format(PyExc_TypeError, |
286 | "can't intern %.400s", s->ob_type->tp_name); |
287 | return NULL((void *)0); |
288 | } |
289 | } |
290 | |
291 | PyDoc_STRVAR(intern_doc,static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." |
292 | "intern(string) -> string\n\static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." |
293 | \n\static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." |
294 | ``Intern'' the given string. This enters the string in the (global)\n\static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." |
295 | table of interned strings whose purpose is to speed up dictionary lookups.\n\static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." |
296 | Return the string itself or the previously interned string object with the\n\static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." |
297 | same value.")static char intern_doc[] = "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value."; |
298 | |
299 | |
300 | /* |
301 | * Cached interned string objects used for calling the profile and |
302 | * trace functions. Initialized by trace_init(). |
303 | */ |
304 | static PyObject *whatstrings[7] = {NULL((void *)0), NULL((void *)0), NULL((void *)0), NULL((void *)0), NULL((void *)0), NULL((void *)0), NULL((void *)0)}; |
305 | |
306 | static int |
307 | trace_init(void) |
308 | { |
309 | static char *whatnames[7] = {"call", "exception", "line", "return", |
310 | "c_call", "c_exception", "c_return"}; |
311 | PyObject *name; |
312 | int i; |
313 | for (i = 0; i < 7; ++i) { |
314 | if (whatstrings[i] == NULL((void *)0)) { |
315 | name = PyUnicode_InternFromString(whatnames[i]); |
316 | if (name == NULL((void *)0)) |
317 | return -1; |
318 | whatstrings[i] = name; |
319 | } |
320 | } |
321 | return 0; |
322 | } |
323 | |
324 | |
325 | static PyObject * |
326 | call_trampoline(PyThreadState *tstate, PyObject* callback, |
327 | PyFrameObject *frame, int what, PyObject *arg) |
328 | { |
329 | PyObject *args = PyTuple_New(3); |
330 | PyObject *whatstr; |
331 | PyObject *result; |
332 | |
333 | if (args == NULL((void *)0)) |
334 | return NULL((void *)0); |
335 | Py_INCREF(frame)( _Py_RefTotal++ , ((PyObject*)(frame))->ob_refcnt++); |
336 | whatstr = whatstrings[what]; |
337 | Py_INCREF(whatstr)( _Py_RefTotal++ , ((PyObject*)(whatstr))->ob_refcnt++); |
338 | if (arg == NULL((void *)0)) |
339 | arg = Py_None(&_Py_NoneStruct); |
340 | Py_INCREF(arg)( _Py_RefTotal++ , ((PyObject*)(arg))->ob_refcnt++); |
341 | PyTuple_SET_ITEM(args, 0, (PyObject *)frame)(((PyTupleObject *)(args))->ob_item[0] = (PyObject *)frame ); |
342 | PyTuple_SET_ITEM(args, 1, whatstr)(((PyTupleObject *)(args))->ob_item[1] = whatstr); |
343 | PyTuple_SET_ITEM(args, 2, arg)(((PyTupleObject *)(args))->ob_item[2] = arg); |
344 | |
345 | /* call the Python-level function */ |
346 | PyFrame_FastToLocals(frame); |
347 | result = PyEval_CallObject(callback, args)PyEval_CallObjectWithKeywords(callback, args, (PyObject *)((void *)0)); |
348 | PyFrame_LocalsToFast(frame, 1); |
349 | if (result == NULL((void *)0)) |
350 | PyTraceBack_Here(frame); |
351 | |
352 | /* cleanup */ |
353 | Py_DECREF(args)do { if (_Py_RefTotal-- , --((PyObject*)(args))->ob_refcnt != 0) { if (((PyObject*)args)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 353, (PyObject *)(args)); } else _Py_Dealloc ((PyObject *)(args)); } while (0); |
354 | return result; |
355 | } |
356 | |
357 | static int |
358 | profile_trampoline(PyObject *self, PyFrameObject *frame, |
359 | int what, PyObject *arg) |
360 | { |
361 | PyThreadState *tstate = frame->f_tstate; |
362 | PyObject *result; |
363 | |
364 | if (arg == NULL((void *)0)) |
365 | arg = Py_None(&_Py_NoneStruct); |
366 | result = call_trampoline(tstate, self, frame, what, arg); |
367 | if (result == NULL((void *)0)) { |
368 | PyEval_SetProfile(NULL((void *)0), NULL((void *)0)); |
369 | return -1; |
370 | } |
371 | Py_DECREF(result)do { if (_Py_RefTotal-- , --((PyObject*)(result))->ob_refcnt != 0) { if (((PyObject*)result)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 371, (PyObject *)(result)); } else _Py_Dealloc ((PyObject *)(result)); } while (0); |
372 | return 0; |
373 | } |
374 | |
375 | static int |
376 | trace_trampoline(PyObject *self, PyFrameObject *frame, |
377 | int what, PyObject *arg) |
378 | { |
379 | PyThreadState *tstate = frame->f_tstate; |
380 | PyObject *callback; |
381 | PyObject *result; |
382 | |
383 | if (what == PyTrace_CALL0) |
384 | callback = self; |
385 | else |
386 | callback = frame->f_trace; |
387 | if (callback == NULL((void *)0)) |
388 | return 0; |
389 | result = call_trampoline(tstate, callback, frame, what, arg); |
390 | if (result == NULL((void *)0)) { |
391 | PyEval_SetTrace(NULL((void *)0), NULL((void *)0)); |
392 | Py_XDECREF(frame->f_trace)do { if ((frame->f_trace) == ((void *)0)) ; else do { if ( _Py_RefTotal-- , --((PyObject*)(frame->f_trace))->ob_refcnt != 0) { if (((PyObject*)frame->f_trace)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c", 392, (PyObject *)(frame->f_trace)); } else _Py_Dealloc((PyObject *)(frame ->f_trace)); } while (0); } while (0); |
393 | frame->f_trace = NULL((void *)0); |
394 | return -1; |
395 | } |
396 | if (result != Py_None(&_Py_NoneStruct)) { |
397 | PyObject *temp = frame->f_trace; |
398 | frame->f_trace = NULL((void *)0); |
399 | Py_XDECREF(temp)do { if ((temp) == ((void *)0)) ; else do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 399, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); } while (0); |
400 | frame->f_trace = result; |
401 | } |
402 | else { |
403 | Py_DECREF(result)do { if (_Py_RefTotal-- , --((PyObject*)(result))->ob_refcnt != 0) { if (((PyObject*)result)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 403, (PyObject *)(result)); } else _Py_Dealloc ((PyObject *)(result)); } while (0); |
404 | } |
405 | return 0; |
406 | } |
407 | |
408 | static PyObject * |
409 | sys_settrace(PyObject *self, PyObject *args) |
410 | { |
411 | if (trace_init() == -1) |
412 | return NULL((void *)0); |
413 | if (args == Py_None(&_Py_NoneStruct)) |
414 | PyEval_SetTrace(NULL((void *)0), NULL((void *)0)); |
415 | else |
416 | PyEval_SetTrace(trace_trampoline, args); |
417 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
418 | return Py_None(&_Py_NoneStruct); |
419 | } |
420 | |
421 | PyDoc_STRVAR(settrace_doc,static char settrace_doc[] = "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." |
422 | "settrace(function)\n\static char settrace_doc[] = "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." |
423 | \n\static char settrace_doc[] = "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." |
424 | Set the global debug tracing function. It will be called on each\n\static char settrace_doc[] = "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." |
425 | function call. See the debugger chapter in the library manual."static char settrace_doc[] = "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." |
426 | )static char settrace_doc[] = "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual."; |
427 | |
428 | static PyObject * |
429 | sys_gettrace(PyObject *self, PyObject *args) |
430 | { |
431 | PyThreadState *tstate = PyThreadState_GET()PyThreadState_Get(); |
432 | PyObject *temp = tstate->c_traceobj; |
433 | |
434 | if (temp == NULL((void *)0)) |
435 | temp = Py_None(&_Py_NoneStruct); |
436 | Py_INCREF(temp)( _Py_RefTotal++ , ((PyObject*)(temp))->ob_refcnt++); |
437 | return temp; |
438 | } |
439 | |
440 | PyDoc_STRVAR(gettrace_doc,static char gettrace_doc[] = "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." |
441 | "gettrace()\n\static char gettrace_doc[] = "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." |
442 | \n\static char gettrace_doc[] = "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." |
443 | Return the global debug tracing function set with sys.settrace.\n\static char gettrace_doc[] = "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." |
444 | See the debugger chapter in the library manual."static char gettrace_doc[] = "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." |
445 | )static char gettrace_doc[] = "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual."; |
446 | |
447 | static PyObject * |
448 | sys_setprofile(PyObject *self, PyObject *args) |
449 | { |
450 | if (trace_init() == -1) |
451 | return NULL((void *)0); |
452 | if (args == Py_None(&_Py_NoneStruct)) |
453 | PyEval_SetProfile(NULL((void *)0), NULL((void *)0)); |
454 | else |
455 | PyEval_SetProfile(profile_trampoline, args); |
456 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
457 | return Py_None(&_Py_NoneStruct); |
458 | } |
459 | |
460 | PyDoc_STRVAR(setprofile_doc,static char setprofile_doc[] = "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." |
461 | "setprofile(function)\n\static char setprofile_doc[] = "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." |
462 | \n\static char setprofile_doc[] = "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." |
463 | Set the profiling function. It will be called on each function call\n\static char setprofile_doc[] = "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." |
464 | and return. See the profiler chapter in the library manual."static char setprofile_doc[] = "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." |
465 | )static char setprofile_doc[] = "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual."; |
466 | |
467 | static PyObject * |
468 | sys_getprofile(PyObject *self, PyObject *args) |
469 | { |
470 | PyThreadState *tstate = PyThreadState_GET()PyThreadState_Get(); |
471 | PyObject *temp = tstate->c_profileobj; |
472 | |
473 | if (temp == NULL((void *)0)) |
474 | temp = Py_None(&_Py_NoneStruct); |
475 | Py_INCREF(temp)( _Py_RefTotal++ , ((PyObject*)(temp))->ob_refcnt++); |
476 | return temp; |
477 | } |
478 | |
479 | PyDoc_STRVAR(getprofile_doc,static char getprofile_doc[] = "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." |
480 | "getprofile()\n\static char getprofile_doc[] = "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." |
481 | \n\static char getprofile_doc[] = "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." |
482 | Return the profiling function set with sys.setprofile.\n\static char getprofile_doc[] = "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." |
483 | See the profiler chapter in the library manual."static char getprofile_doc[] = "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." |
484 | )static char getprofile_doc[] = "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual."; |
485 | |
486 | static int _check_interval = 100; |
487 | |
488 | static PyObject * |
489 | sys_setcheckinterval(PyObject *self, PyObject *args) |
490 | { |
491 | if (PyErr_WarnEx(PyExc_DeprecationWarning, |
492 | "sys.getcheckinterval() and sys.setcheckinterval() " |
493 | "are deprecated. Use sys.setswitchinterval() " |
494 | "instead.", 1) < 0) |
495 | return NULL((void *)0); |
496 | if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval)) |
497 | return NULL((void *)0); |
498 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
499 | return Py_None(&_Py_NoneStruct); |
500 | } |
501 | |
502 | PyDoc_STRVAR(setcheckinterval_doc,static char setcheckinterval_doc[] = "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." |
503 | "setcheckinterval(n)\n\static char setcheckinterval_doc[] = "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." |
504 | \n\static char setcheckinterval_doc[] = "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." |
505 | Tell the Python interpreter to check for asynchronous events every\n\static char setcheckinterval_doc[] = "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." |
506 | n instructions. This also affects how often thread switches occur."static char setcheckinterval_doc[] = "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." |
507 | )static char setcheckinterval_doc[] = "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur."; |
508 | |
509 | static PyObject * |
510 | sys_getcheckinterval(PyObject *self, PyObject *args) |
511 | { |
512 | if (PyErr_WarnEx(PyExc_DeprecationWarning, |
513 | "sys.getcheckinterval() and sys.setcheckinterval() " |
514 | "are deprecated. Use sys.getswitchinterval() " |
515 | "instead.", 1) < 0) |
516 | return NULL((void *)0); |
517 | return PyLong_FromLong(_check_interval); |
518 | } |
519 | |
520 | PyDoc_STRVAR(getcheckinterval_doc,static char getcheckinterval_doc[] = "getcheckinterval() -> current check interval; see setcheckinterval()." |
521 | "getcheckinterval() -> current check interval; see setcheckinterval()."static char getcheckinterval_doc[] = "getcheckinterval() -> current check interval; see setcheckinterval()." |
522 | )static char getcheckinterval_doc[] = "getcheckinterval() -> current check interval; see setcheckinterval()."; |
523 | |
524 | #ifdef WITH_THREAD1 |
525 | static PyObject * |
526 | sys_setswitchinterval(PyObject *self, PyObject *args) |
527 | { |
528 | double d; |
529 | if (!PyArg_ParseTuple(args, "d:setswitchinterval", &d)) |
530 | return NULL((void *)0); |
531 | if (d <= 0.0) { |
532 | PyErr_SetString(PyExc_ValueError, |
533 | "switch interval must be strictly positive"); |
534 | return NULL((void *)0); |
535 | } |
536 | _PyEval_SetSwitchInterval((unsigned long) (1e6 * d)); |
537 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
538 | return Py_None(&_Py_NoneStruct); |
539 | } |
540 | |
541 | PyDoc_STRVAR(setswitchinterval_doc,static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
542 | "setswitchinterval(n)\n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
543 | \n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
544 | Set the ideal thread switching delay inside the Python interpreter\n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
545 | The actual frequency of switching threads can be lower if the\n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
546 | interpreter executes long sequences of uninterruptible code\n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
547 | (this is implementation-specific and workload-dependent).\n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
548 | \n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
549 | The parameter must represent the desired switching delay in seconds\n\static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
550 | A typical value is 0.005 (5 milliseconds)."static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." |
551 | )static char setswitchinterval_doc[] = "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)."; |
552 | |
553 | static PyObject * |
554 | sys_getswitchinterval(PyObject *self, PyObject *args) |
555 | { |
556 | return PyFloat_FromDouble(1e-6 * _PyEval_GetSwitchInterval()); |
557 | } |
558 | |
559 | PyDoc_STRVAR(getswitchinterval_doc,static char getswitchinterval_doc[] = "getswitchinterval() -> current thread switch interval; see setswitchinterval()." |
560 | "getswitchinterval() -> current thread switch interval; see setswitchinterval()."static char getswitchinterval_doc[] = "getswitchinterval() -> current thread switch interval; see setswitchinterval()." |
561 | )static char getswitchinterval_doc[] = "getswitchinterval() -> current thread switch interval; see setswitchinterval()."; |
562 | |
563 | #endif /* WITH_THREAD */ |
564 | |
565 | #ifdef WITH_TSC |
566 | static PyObject * |
567 | sys_settscdump(PyObject *self, PyObject *args) |
568 | { |
569 | int bool; |
570 | PyThreadState *tstate = PyThreadState_Get(); |
571 | |
572 | if (!PyArg_ParseTuple(args, "i:settscdump", &bool)) |
573 | return NULL((void *)0); |
574 | if (bool) |
575 | tstate->interp->tscdump = 1; |
576 | else |
577 | tstate->interp->tscdump = 0; |
578 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
579 | return Py_None(&_Py_NoneStruct); |
580 | |
581 | } |
582 | |
583 | PyDoc_STRVAR(settscdump_doc,static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter." |
584 | "settscdump(bool)\n\static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter." |
585 | \n\static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter." |
586 | If true, tell the Python interpreter to dump VM measurements to\n\static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter." |
587 | stderr. If false, turn off dump. The measurements are based on the\n\static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter." |
588 | processor's time-stamp counter."static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter." |
589 | )static char settscdump_doc[] = "settscdump(bool)\n\nIf true, tell the Python interpreter to dump VM measurements to\nstderr. If false, turn off dump. The measurements are based on the\nprocessor's time-stamp counter."; |
590 | #endif /* TSC */ |
591 | |
592 | static PyObject * |
593 | sys_setrecursionlimit(PyObject *self, PyObject *args) |
594 | { |
595 | int new_limit; |
596 | if (!PyArg_ParseTuple(args, "i:setrecursionlimit", &new_limit)) |
597 | return NULL((void *)0); |
598 | if (new_limit <= 0) { |
599 | PyErr_SetString(PyExc_ValueError, |
600 | "recursion limit must be positive"); |
601 | return NULL((void *)0); |
602 | } |
603 | Py_SetRecursionLimit(new_limit); |
604 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
605 | return Py_None(&_Py_NoneStruct); |
606 | } |
607 | |
608 | static PyTypeObject Hash_InfoType; |
609 | |
610 | PyDoc_STRVAR(hash_info_doc,static char hash_info_doc[] = "hash_info\n\nA struct sequence providing parameters used for computing\nnumeric hashes. The attributes are read only." |
611 | "hash_info\n\static char hash_info_doc[] = "hash_info\n\nA struct sequence providing parameters used for computing\nnumeric hashes. The attributes are read only." |
612 | \n\static char hash_info_doc[] = "hash_info\n\nA struct sequence providing parameters used for computing\nnumeric hashes. The attributes are read only." |
613 | A struct sequence providing parameters used for computing\n\static char hash_info_doc[] = "hash_info\n\nA struct sequence providing parameters used for computing\nnumeric hashes. The attributes are read only." |
614 | numeric hashes. The attributes are read only.")static char hash_info_doc[] = "hash_info\n\nA struct sequence providing parameters used for computing\nnumeric hashes. The attributes are read only."; |
615 | |
616 | static PyStructSequence_Field hash_info_fields[] = { |
617 | {"width", "width of the type used for hashing, in bits"}, |
618 | {"modulus", "prime number giving the modulus on which the hash " |
619 | "function is based"}, |
620 | {"inf", "value to be used for hash of a positive infinity"}, |
621 | {"nan", "value to be used for hash of a nan"}, |
622 | {"imag", "multiplier used for the imaginary part of a complex number"}, |
623 | {NULL((void *)0), NULL((void *)0)} |
624 | }; |
625 | |
626 | static PyStructSequence_Desc hash_info_desc = { |
627 | "sys.hash_info", |
628 | hash_info_doc, |
629 | hash_info_fields, |
630 | 5, |
631 | }; |
632 | |
633 | static PyObject * |
634 | get_hash_info(void) |
635 | { |
636 | PyObject *hash_info; |
637 | int field = 0; |
638 | hash_info = PyStructSequence_New(&Hash_InfoType); |
639 | if (hash_info == NULL((void *)0)) |
640 | return NULL((void *)0); |
641 | PyStructSequence_SET_ITEM(hash_info, field++,(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (8*sizeof(Py_hash_t))) |
642 | PyLong_FromLong(8*sizeof(Py_hash_t)))(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (8*sizeof(Py_hash_t))); |
643 | PyStructSequence_SET_ITEM(hash_info, field++,(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromSsize_t ((((size_t)1 << 61) - 1))) |
644 | PyLong_FromSsize_t(_PyHASH_MODULUS))(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromSsize_t ((((size_t)1 << 61) - 1))); |
645 | PyStructSequence_SET_ITEM(hash_info, field++,(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (314159)) |
646 | PyLong_FromLong(_PyHASH_INF))(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (314159)); |
647 | PyStructSequence_SET_ITEM(hash_info, field++,(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (0)) |
648 | PyLong_FromLong(_PyHASH_NAN))(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (0)); |
649 | PyStructSequence_SET_ITEM(hash_info, field++,(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (1000003UL)) |
650 | PyLong_FromLong(_PyHASH_IMAG))(((PyTupleObject *)(hash_info))->ob_item[field++] = PyLong_FromLong (1000003UL)); |
651 | if (PyErr_Occurred()) { |
652 | Py_CLEAR(hash_info)do { if (hash_info) { PyObject *_py_tmp = (PyObject *)(hash_info ); (hash_info) = ((void *)0); do { if (_Py_RefTotal-- , --((PyObject *)(_py_tmp))->ob_refcnt != 0) { if (((PyObject*)_py_tmp)-> ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 652, (PyObject *)(_py_tmp)); } else _Py_Dealloc((PyObject * )(_py_tmp)); } while (0); } } while (0); |
653 | return NULL((void *)0); |
654 | } |
655 | return hash_info; |
656 | } |
657 | |
658 | |
659 | PyDoc_STRVAR(setrecursionlimit_doc,static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
660 | "setrecursionlimit(n)\n\static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
661 | \n\static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
662 | Set the maximum depth of the Python interpreter stack to n. This\n\static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
663 | limit prevents infinite recursion from causing an overflow of the C\n\static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
664 | stack and crashing Python. The highest possible limit is platform-\n\static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
665 | dependent."static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." |
666 | )static char setrecursionlimit_doc[] = "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent."; |
667 | |
668 | static PyObject * |
669 | sys_getrecursionlimit(PyObject *self) |
670 | { |
671 | return PyLong_FromLong(Py_GetRecursionLimit()); |
672 | } |
673 | |
674 | PyDoc_STRVAR(getrecursionlimit_doc,static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." |
675 | "getrecursionlimit()\n\static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." |
676 | \n\static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." |
677 | Return the current value of the recursion limit, the maximum depth\n\static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." |
678 | of the Python interpreter stack. This limit prevents infinite\n\static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." |
679 | recursion from causing an overflow of the C stack and crashing Python."static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." |
680 | )static char getrecursionlimit_doc[] = "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python."; |
681 | |
682 | #ifdef MS_WINDOWS |
683 | PyDoc_STRVAR(getwindowsversion_doc,static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
684 | "getwindowsversion()\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
685 | \n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
686 | Return information about the running version of Windows as a named tuple.\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
687 | The members are named: major, minor, build, platform, service_pack,\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
688 | service_pack_major, service_pack_minor, suite_mask, and product_type. For\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
689 | backward compatibiliy, only the first 5 items are available by indexing.\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
690 | All elements are numbers, except service_pack which is a string. Platform\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
691 | may be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
692 | 3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\n\static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
693 | controller, 3 for a server."static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server." |
694 | )static char getwindowsversion_doc[] = "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibiliy, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack which is a string. Platform\nmay be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\ncontroller, 3 for a server."; |
695 | |
696 | static PyTypeObject WindowsVersionType = {0, 0, 0, 0, 0, 0}; |
697 | |
698 | static PyStructSequence_Field windows_version_fields[] = { |
699 | {"major", "Major version number"}, |
700 | {"minor", "Minor version number"}, |
701 | {"build", "Build number"}, |
702 | {"platform", "Operating system platform"}, |
703 | {"service_pack", "Latest Service Pack installed on the system"}, |
704 | {"service_pack_major", "Service Pack major version number"}, |
705 | {"service_pack_minor", "Service Pack minor version number"}, |
706 | {"suite_mask", "Bit mask identifying available product suites"}, |
707 | {"product_type", "System product type"}, |
708 | {0} |
709 | }; |
710 | |
711 | static PyStructSequence_Desc windows_version_desc = { |
712 | "sys.getwindowsversion", /* name */ |
713 | getwindowsversion_doc, /* doc */ |
714 | windows_version_fields, /* fields */ |
715 | 5 /* For backward compatibility, |
716 | only the first 5 items are accessible |
717 | via indexing, the rest are name only */ |
718 | }; |
719 | |
720 | static PyObject * |
721 | sys_getwindowsversion(PyObject *self) |
722 | { |
723 | PyObject *version; |
724 | int pos = 0; |
725 | OSVERSIONINFOEX ver; |
726 | ver.dwOSVersionInfoSize = sizeof(ver); |
727 | if (!GetVersionEx((OSVERSIONINFO*) &ver)) |
728 | return PyErr_SetFromWindowsErr(0); |
729 | |
730 | version = PyStructSequence_New(&WindowsVersionType); |
731 | if (version == NULL((void *)0)) |
732 | return NULL((void *)0); |
733 | |
734 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwMajorVersion))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.dwMajorVersion)); |
735 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwMinorVersion))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.dwMinorVersion)); |
736 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwBuildNumber))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.dwBuildNumber)); |
737 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwPlatformId))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.dwPlatformId)); |
738 | PyStructSequence_SET_ITEM(version, pos++, PyUnicode_FromString(ver.szCSDVersion))(((PyTupleObject *)(version))->ob_item[pos++] = PyUnicodeUCS2_FromString (ver.szCSDVersion)); |
739 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wServicePackMajor))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.wServicePackMajor)); |
740 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wServicePackMinor))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.wServicePackMinor)); |
741 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wSuiteMask))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.wSuiteMask)); |
742 | PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wProductType))(((PyTupleObject *)(version))->ob_item[pos++] = PyLong_FromLong (ver.wProductType)); |
743 | |
744 | return version; |
745 | } |
746 | |
747 | #endif /* MS_WINDOWS */ |
748 | |
749 | #ifdef HAVE_DLOPEN1 |
750 | static PyObject * |
751 | sys_setdlopenflags(PyObject *self, PyObject *args) |
752 | { |
753 | int new_val; |
754 | PyThreadState *tstate = PyThreadState_GET()PyThreadState_Get(); |
755 | if (!PyArg_ParseTuple(args, "i:setdlopenflags", &new_val)) |
756 | return NULL((void *)0); |
757 | if (!tstate) |
758 | return NULL((void *)0); |
759 | tstate->interp->dlopenflags = new_val; |
760 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
761 | return Py_None(&_Py_NoneStruct); |
762 | } |
763 | |
764 | PyDoc_STRVAR(setdlopenflags_doc,static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
765 | "setdlopenflags(n) -> None\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
766 | \n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
767 | Set the flags used by the interpreter for dlopen calls, such as when the\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
768 | interpreter loads extension modules. Among other things, this will enable\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
769 | a lazy resolving of symbols when importing a module, if called as\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
770 | sys.setdlopenflags(0). To share symbols across extension modules, call as\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
771 | sys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
772 | can be either found in the ctypes module, or in the DLFCN module. If DLFCN\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
773 | is not available, it can be generated from /usr/include/dlfcn.h using the\n\static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script." |
774 | h2py script.")static char setdlopenflags_doc[] = "setdlopenflags(n) -> None\n\nSet the flags used by the interpreter for dlopen calls, such as when the\ninterpreter loads extension modules. Among other things, this will enable\na lazy resolving of symbols when importing a module, if called as\nsys.setdlopenflags(0). To share symbols across extension modules, call as\nsys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\ncan be either found in the ctypes module, or in the DLFCN module. If DLFCN\nis not available, it can be generated from /usr/include/dlfcn.h using the\nh2py script."; |
775 | |
776 | static PyObject * |
777 | sys_getdlopenflags(PyObject *self, PyObject *args) |
778 | { |
779 | PyThreadState *tstate = PyThreadState_GET()PyThreadState_Get(); |
780 | if (!tstate) |
781 | return NULL((void *)0); |
782 | return PyLong_FromLong(tstate->interp->dlopenflags); |
783 | } |
784 | |
785 | PyDoc_STRVAR(getdlopenflags_doc,static char getdlopenflags_doc[] = "getdlopenflags() -> int\n\nReturn the current value of the flags that are used for dlopen calls.\nThe flag constants are defined in the ctypes and DLFCN modules." |
786 | "getdlopenflags() -> int\n\static char getdlopenflags_doc[] = "getdlopenflags() -> int\n\nReturn the current value of the flags that are used for dlopen calls.\nThe flag constants are defined in the ctypes and DLFCN modules." |
787 | \n\static char getdlopenflags_doc[] = "getdlopenflags() -> int\n\nReturn the current value of the flags that are used for dlopen calls.\nThe flag constants are defined in the ctypes and DLFCN modules." |
788 | Return the current value of the flags that are used for dlopen calls.\n\static char getdlopenflags_doc[] = "getdlopenflags() -> int\n\nReturn the current value of the flags that are used for dlopen calls.\nThe flag constants are defined in the ctypes and DLFCN modules." |
789 | The flag constants are defined in the ctypes and DLFCN modules.")static char getdlopenflags_doc[] = "getdlopenflags() -> int\n\nReturn the current value of the flags that are used for dlopen calls.\nThe flag constants are defined in the ctypes and DLFCN modules."; |
790 | |
791 | #endif /* HAVE_DLOPEN */ |
792 | |
793 | #ifdef USE_MALLOPT |
794 | /* Link with -lmalloc (or -lmpc) on an SGI */ |
795 | #include <malloc.h> |
796 | |
797 | static PyObject * |
798 | sys_mdebug(PyObject *self, PyObject *args) |
799 | { |
800 | int flag; |
801 | if (!PyArg_ParseTuple(args, "i:mdebug", &flag)) |
802 | return NULL((void *)0); |
803 | mallopt(M_DEBUG, flag); |
804 | Py_INCREF(Py_None)( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)))->ob_refcnt ++); |
805 | return Py_None(&_Py_NoneStruct); |
806 | } |
807 | #endif /* USE_MALLOPT */ |
808 | |
809 | static PyObject * |
810 | sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) |
811 | { |
812 | PyObject *res = NULL((void *)0); |
813 | static PyObject *str__sizeof__ = NULL((void *)0), *gc_head_size = NULL((void *)0); |
814 | static char *kwlist[] = {"object", "default", 0}; |
815 | PyObject *o, *dflt = NULL((void *)0); |
816 | PyObject *method; |
817 | |
818 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof", |
819 | kwlist, &o, &dflt)) |
820 | return NULL((void *)0); |
821 | |
822 | /* Initialize static variable for GC head size */ |
823 | if (gc_head_size == NULL((void *)0)) { |
824 | gc_head_size = PyLong_FromSsize_t(sizeof(PyGC_Head)); |
825 | if (gc_head_size == NULL((void *)0)) |
826 | return NULL((void *)0); |
827 | } |
828 | |
829 | /* Make sure the type is initialized. float gets initialized late */ |
830 | if (PyType_Ready(Py_TYPE(o)(((PyObject*)(o))->ob_type)) < 0) |
831 | return NULL((void *)0); |
832 | |
833 | method = _PyObject_LookupSpecial(o, "__sizeof__", |
834 | &str__sizeof__); |
835 | if (method == NULL((void *)0)) { |
836 | if (!PyErr_Occurred()) |
837 | PyErr_Format(PyExc_TypeError, |
838 | "Type %.100s doesn't define __sizeof__", |
839 | Py_TYPE(o)(((PyObject*)(o))->ob_type)->tp_name); |
840 | } |
841 | else { |
842 | res = PyObject_CallFunctionObjArgs(method, NULL((void *)0)); |
843 | Py_DECREF(method)do { if (_Py_RefTotal-- , --((PyObject*)(method))->ob_refcnt != 0) { if (((PyObject*)method)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 843, (PyObject *)(method)); } else _Py_Dealloc ((PyObject *)(method)); } while (0); |
844 | } |
845 | |
846 | /* Has a default value been given */ |
847 | if ((res == NULL((void *)0)) && (dflt != NULL((void *)0)) && |
848 | PyErr_ExceptionMatches(PyExc_TypeError)) |
849 | { |
850 | PyErr_Clear(); |
851 | Py_INCREF(dflt)( _Py_RefTotal++ , ((PyObject*)(dflt))->ob_refcnt++); |
852 | return dflt; |
853 | } |
854 | else if (res == NULL((void *)0)) |
855 | return res; |
856 | |
857 | /* add gc_head size */ |
858 | if (PyObject_IS_GC(o)((((((((PyObject*)(o))->ob_type)))->tp_flags & ((1L <<14))) != 0) && ((((PyObject*)(o))->ob_type )->tp_is_gc == ((void *)0) || (((PyObject*)(o))->ob_type )->tp_is_gc(o)))) { |
859 | PyObject *tmp = res; |
860 | res = PyNumber_Add(tmp, gc_head_size); |
861 | Py_DECREF(tmp)do { if (_Py_RefTotal-- , --((PyObject*)(tmp))->ob_refcnt != 0) { if (((PyObject*)tmp)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 861, (PyObject *)(tmp)); } else _Py_Dealloc ((PyObject *)(tmp)); } while (0); |
862 | } |
863 | return res; |
864 | } |
865 | |
866 | PyDoc_STRVAR(getsizeof_doc,static char getsizeof_doc[] = "getsizeof(object, default) -> int\n\nReturn the size of object in bytes." |
867 | "getsizeof(object, default) -> int\n\static char getsizeof_doc[] = "getsizeof(object, default) -> int\n\nReturn the size of object in bytes." |
868 | \n\static char getsizeof_doc[] = "getsizeof(object, default) -> int\n\nReturn the size of object in bytes." |
869 | Return the size of object in bytes.")static char getsizeof_doc[] = "getsizeof(object, default) -> int\n\nReturn the size of object in bytes."; |
870 | |
871 | static PyObject * |
872 | sys_getrefcount(PyObject *self, PyObject *arg) |
873 | { |
874 | return PyLong_FromSsize_t(arg->ob_refcnt); |
875 | } |
876 | |
877 | #ifdef Py_REF_DEBUG |
878 | static PyObject * |
879 | sys_gettotalrefcount(PyObject *self) |
880 | { |
881 | return PyLong_FromSsize_t(_Py_GetRefTotal()); |
882 | } |
883 | #endif /* Py_REF_DEBUG */ |
884 | |
885 | PyDoc_STRVAR(getrefcount_doc,static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." |
886 | "getrefcount(object) -> integer\n\static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." |
887 | \n\static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." |
888 | Return the reference count of object. The count returned is generally\n\static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." |
889 | one higher than you might expect, because it includes the (temporary)\n\static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." |
890 | reference as an argument to getrefcount()."static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." |
891 | )static char getrefcount_doc[] = "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()."; |
892 | |
893 | #ifdef COUNT_ALLOCS |
894 | static PyObject * |
895 | sys_getcounts(PyObject *self) |
896 | { |
897 | extern PyObject *get_counts(void); |
898 | |
899 | return get_counts(); |
900 | } |
901 | #endif |
902 | |
903 | PyDoc_STRVAR(getframe_doc,static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
904 | "_getframe([depth]) -> frameobject\n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
905 | \n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
906 | Return a frame object from the call stack. If optional integer depth is\n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
907 | given, return the frame object that many calls below the top of the stack.\n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
908 | If that is deeper than the call stack, ValueError is raised. The default\n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
909 | for depth is zero, returning the frame at the top of the call stack.\n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
910 | \n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
911 | This function should be used for internal and specialized\n\static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
912 | purposes only."static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." |
913 | )static char getframe_doc[] = "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only."; |
914 | |
915 | static PyObject * |
916 | sys_getframe(PyObject *self, PyObject *args) |
917 | { |
918 | PyFrameObject *f = PyThreadState_GET()PyThreadState_Get()->frame; |
919 | int depth = -1; |
920 | |
921 | if (!PyArg_ParseTuple(args, "|i:_getframe", &depth)) |
922 | return NULL((void *)0); |
923 | |
924 | while (depth > 0 && f != NULL((void *)0)) { |
925 | f = f->f_back; |
926 | --depth; |
927 | } |
928 | if (f == NULL((void *)0)) { |
929 | PyErr_SetString(PyExc_ValueError, |
930 | "call stack is not deep enough"); |
931 | return NULL((void *)0); |
932 | } |
933 | Py_INCREF(f)( _Py_RefTotal++ , ((PyObject*)(f))->ob_refcnt++); |
934 | return (PyObject*)f; |
935 | } |
936 | |
937 | PyDoc_STRVAR(current_frames_doc,static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
938 | "_current_frames() -> dictionary\n\static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
939 | \n\static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
940 | Return a dictionary mapping each current thread T's thread id to T's\n\static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
941 | current stack frame.\n\static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
942 | \n\static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
943 | This function should be used for specialized purposes only."static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." |
944 | )static char current_frames_doc[] = "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only."; |
945 | |
946 | static PyObject * |
947 | sys_current_frames(PyObject *self, PyObject *noargs) |
948 | { |
949 | return _PyThread_CurrentFrames(); |
950 | } |
951 | |
952 | PyDoc_STRVAR(call_tracing_doc,static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." |
953 | "call_tracing(func, args) -> object\n\static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." |
954 | \n\static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." |
955 | Call func(*args), while tracing is enabled. The tracing state is\n\static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." |
956 | saved, and restored afterwards. This is intended to be called from\n\static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." |
957 | a debugger from a checkpoint, to recursively debug some other code."static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." |
958 | )static char call_tracing_doc[] = "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code."; |
959 | |
960 | static PyObject * |
961 | sys_call_tracing(PyObject *self, PyObject *args) |
962 | { |
963 | PyObject *func, *funcargs; |
964 | if (!PyArg_ParseTuple(args, "OO!:call_tracing", &func, &PyTuple_Type, &funcargs)) |
965 | return NULL((void *)0); |
966 | return _PyEval_CallTracing(func, funcargs); |
967 | } |
968 | |
969 | PyDoc_STRVAR(callstats_doc,static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
970 | "callstats() -> tuple of integers\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
971 | \n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
972 | Return a tuple of function call statistics, if CALL_PROFILE was defined\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
973 | when Python was built. Otherwise, return None.\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
974 | \n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
975 | When enabled, this function returns detailed, implementation-specific\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
976 | details about the number of function calls executed. The return value is\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
977 | a 11-tuple where the entries in the tuple are counts of:\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
978 | 0. all function calls\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
979 | 1. calls to PyFunction_Type objects\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
980 | 2. PyFunction calls that do not create an argument tuple\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
981 | 3. PyFunction calls that do not create an argument tuple\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
982 | and bypass PyEval_EvalCodeEx()\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
983 | 4. PyMethod calls\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
984 | 5. PyMethod calls on bound methods\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
985 | 6. PyType calls\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
986 | 7. PyCFunction calls\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
987 | 8. generator calls\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
988 | 9. All other calls\n\static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
989 | 10. Number of stack pops performed by call_function()"static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" |
990 | )static char callstats_doc[] = "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()"; |
991 | |
992 | #ifdef __cplusplus |
993 | extern "C" { |
994 | #endif |
995 | |
996 | #ifdef Py_TRACE_REFS |
997 | /* Defined in objects.c because it uses static globals if that file */ |
998 | extern PyObject *_Py_GetObjects(PyObject *, PyObject *); |
999 | #endif |
1000 | |
1001 | #ifdef DYNAMIC_EXECUTION_PROFILE |
1002 | /* Defined in ceval.c because it uses static globals if that file */ |
1003 | extern PyObject *_Py_GetDXProfile(PyObject *, PyObject *); |
1004 | #endif |
1005 | |
1006 | #ifdef __cplusplus |
1007 | } |
1008 | #endif |
1009 | |
1010 | static PyObject * |
1011 | sys_clear_type_cache(PyObject* self, PyObject* args) |
1012 | { |
1013 | PyType_ClearCache(); |
1014 | Py_RETURN_NONEreturn ( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)) )->ob_refcnt++), (&_Py_NoneStruct); |
1015 | } |
1016 | |
1017 | PyDoc_STRVAR(sys_clear_type_cache__doc__,static char sys_clear_type_cache__doc__[] = "_clear_type_cache() -> None\nClear the internal type lookup cache." |
1018 | "_clear_type_cache() -> None\n\static char sys_clear_type_cache__doc__[] = "_clear_type_cache() -> None\nClear the internal type lookup cache." |
1019 | Clear the internal type lookup cache.")static char sys_clear_type_cache__doc__[] = "_clear_type_cache() -> None\nClear the internal type lookup cache."; |
1020 | |
1021 | |
1022 | static PyMethodDef sys_methods[] = { |
1023 | /* Might as well keep this in alphabetic order */ |
1024 | {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS0x0004, |
1025 | callstats_doc}, |
1026 | {"_clear_type_cache", sys_clear_type_cache, METH_NOARGS0x0004, |
1027 | sys_clear_type_cache__doc__}, |
1028 | {"_current_frames", sys_current_frames, METH_NOARGS0x0004, |
1029 | current_frames_doc}, |
1030 | {"displayhook", sys_displayhook, METH_O0x0008, displayhook_doc}, |
1031 | {"exc_info", sys_exc_info, METH_NOARGS0x0004, exc_info_doc}, |
1032 | {"excepthook", sys_excepthook, METH_VARARGS0x0001, excepthook_doc}, |
1033 | {"exit", sys_exit, METH_VARARGS0x0001, exit_doc}, |
1034 | {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, |
1035 | METH_NOARGS0x0004, getdefaultencoding_doc}, |
1036 | #ifdef HAVE_DLOPEN1 |
1037 | {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS0x0004, |
1038 | getdlopenflags_doc}, |
1039 | #endif |
1040 | #ifdef COUNT_ALLOCS |
1041 | {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS0x0004}, |
1042 | #endif |
1043 | #ifdef DYNAMIC_EXECUTION_PROFILE |
1044 | {"getdxp", _Py_GetDXProfile, METH_VARARGS0x0001}, |
1045 | #endif |
1046 | {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, |
1047 | METH_NOARGS0x0004, getfilesystemencoding_doc}, |
1048 | #ifdef Py_TRACE_REFS |
1049 | {"getobjects", _Py_GetObjects, METH_VARARGS0x0001}, |
1050 | #endif |
1051 | #ifdef Py_REF_DEBUG |
1052 | {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS0x0004}, |
1053 | #endif |
1054 | {"getrefcount", (PyCFunction)sys_getrefcount, METH_O0x0008, getrefcount_doc}, |
1055 | {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS0x0004, |
1056 | getrecursionlimit_doc}, |
1057 | {"getsizeof", (PyCFunction)sys_getsizeof, |
1058 | METH_VARARGS0x0001 | METH_KEYWORDS0x0002, getsizeof_doc}, |
1059 | {"_getframe", sys_getframe, METH_VARARGS0x0001, getframe_doc}, |
1060 | #ifdef MS_WINDOWS |
1061 | {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS0x0004, |
1062 | getwindowsversion_doc}, |
1063 | #endif /* MS_WINDOWS */ |
1064 | {"intern", sys_intern, METH_VARARGS0x0001, intern_doc}, |
1065 | #ifdef USE_MALLOPT |
1066 | {"mdebug", sys_mdebug, METH_VARARGS0x0001}, |
1067 | #endif |
1068 | {"setcheckinterval", sys_setcheckinterval, METH_VARARGS0x0001, |
1069 | setcheckinterval_doc}, |
1070 | {"getcheckinterval", sys_getcheckinterval, METH_NOARGS0x0004, |
1071 | getcheckinterval_doc}, |
1072 | #ifdef WITH_THREAD1 |
1073 | {"setswitchinterval", sys_setswitchinterval, METH_VARARGS0x0001, |
1074 | setswitchinterval_doc}, |
1075 | {"getswitchinterval", sys_getswitchinterval, METH_NOARGS0x0004, |
1076 | getswitchinterval_doc}, |
1077 | #endif |
1078 | #ifdef HAVE_DLOPEN1 |
1079 | {"setdlopenflags", sys_setdlopenflags, METH_VARARGS0x0001, |
1080 | setdlopenflags_doc}, |
1081 | #endif |
1082 | {"setprofile", sys_setprofile, METH_O0x0008, setprofile_doc}, |
1083 | {"getprofile", sys_getprofile, METH_NOARGS0x0004, getprofile_doc}, |
1084 | {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS0x0001, |
1085 | setrecursionlimit_doc}, |
1086 | #ifdef WITH_TSC |
1087 | {"settscdump", sys_settscdump, METH_VARARGS0x0001, settscdump_doc}, |
1088 | #endif |
1089 | {"settrace", sys_settrace, METH_O0x0008, settrace_doc}, |
1090 | {"gettrace", sys_gettrace, METH_NOARGS0x0004, gettrace_doc}, |
1091 | {"call_tracing", sys_call_tracing, METH_VARARGS0x0001, call_tracing_doc}, |
1092 | {NULL((void *)0), NULL((void *)0)} /* sentinel */ |
1093 | }; |
1094 | |
1095 | static PyObject * |
1096 | list_builtin_module_names(void) |
1097 | { |
1098 | PyObject *list = PyList_New(0); |
1099 | int i; |
1100 | if (list == NULL((void *)0)) |
1101 | return NULL((void *)0); |
1102 | for (i = 0; PyImport_Inittab[i].name != NULL((void *)0); i++) { |
1103 | PyObject *name = PyUnicode_FromStringPyUnicodeUCS2_FromString( |
1104 | PyImport_Inittab[i].name); |
1105 | if (name == NULL((void *)0)) |
1106 | break; |
1107 | PyList_Append(list, name); |
1108 | Py_DECREF(name)do { if (_Py_RefTotal-- , --((PyObject*)(name))->ob_refcnt != 0) { if (((PyObject*)name)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1108, (PyObject *)(name)); } else _Py_Dealloc ((PyObject *)(name)); } while (0); |
1109 | } |
1110 | if (PyList_Sort(list) != 0) { |
1111 | Py_DECREF(list)do { if (_Py_RefTotal-- , --((PyObject*)(list))->ob_refcnt != 0) { if (((PyObject*)list)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1111, (PyObject *)(list)); } else _Py_Dealloc ((PyObject *)(list)); } while (0); |
1112 | list = NULL((void *)0); |
1113 | } |
1114 | if (list) { |
1115 | PyObject *v = PyList_AsTuple(list); |
1116 | Py_DECREF(list)do { if (_Py_RefTotal-- , --((PyObject*)(list))->ob_refcnt != 0) { if (((PyObject*)list)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1116, (PyObject *)(list)); } else _Py_Dealloc ((PyObject *)(list)); } while (0); |
1117 | list = v; |
1118 | } |
1119 | return list; |
1120 | } |
1121 | |
1122 | static PyObject *warnoptions = NULL((void *)0); |
1123 | |
1124 | void |
1125 | PySys_ResetWarnOptions(void) |
1126 | { |
1127 | if (warnoptions == NULL((void *)0) || !PyList_Check(warnoptions)((((((PyObject*)(warnoptions))->ob_type))->tp_flags & ((1L<<25))) != 0)) |
1128 | return; |
1129 | PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions)(((PyVarObject*)(warnoptions))->ob_size), NULL((void *)0)); |
1130 | } |
1131 | |
1132 | void |
1133 | PySys_AddWarnOptionUnicode(PyObject *unicode) |
1134 | { |
1135 | if (warnoptions == NULL((void *)0) || !PyList_Check(warnoptions)((((((PyObject*)(warnoptions))->ob_type))->tp_flags & ((1L<<25))) != 0)) { |
1136 | Py_XDECREF(warnoptions)do { if ((warnoptions) == ((void *)0)) ; else do { if (_Py_RefTotal -- , --((PyObject*)(warnoptions))->ob_refcnt != 0) { if (( (PyObject*)warnoptions)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1136, (PyObject *)(warnoptions)); } else _Py_Dealloc((PyObject *)(warnoptions)); } while (0); } while (0); |
1137 | warnoptions = PyList_New(0); |
1138 | if (warnoptions == NULL((void *)0)) |
1139 | return; |
1140 | } |
1141 | PyList_Append(warnoptions, unicode); |
1142 | } |
1143 | |
1144 | void |
1145 | PySys_AddWarnOption(const wchar_t *s) |
1146 | { |
1147 | PyObject *unicode; |
1148 | unicode = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(s, -1); |
1149 | if (unicode == NULL((void *)0)) |
1150 | return; |
1151 | PySys_AddWarnOptionUnicode(unicode); |
1152 | Py_DECREF(unicode)do { if (_Py_RefTotal-- , --((PyObject*)(unicode))->ob_refcnt != 0) { if (((PyObject*)unicode)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1152, (PyObject *)(unicode)); } else _Py_Dealloc((PyObject *)(unicode)); } while (0); |
1153 | } |
1154 | |
1155 | int |
1156 | PySys_HasWarnOptions(void) |
1157 | { |
1158 | return (warnoptions != NULL((void *)0) && (PyList_Size(warnoptions) > 0)) ? 1 : 0; |
1159 | } |
1160 | |
1161 | static PyObject *xoptions = NULL((void *)0); |
1162 | |
1163 | static PyObject * |
1164 | get_xoptions(void) |
1165 | { |
1166 | if (xoptions == NULL((void *)0) || !PyDict_Check(xoptions)((((((PyObject*)(xoptions))->ob_type))->tp_flags & ( (1L<<29))) != 0)) { |
1167 | Py_XDECREF(xoptions)do { if ((xoptions) == ((void *)0)) ; else do { if (_Py_RefTotal -- , --((PyObject*)(xoptions))->ob_refcnt != 0) { if (((PyObject *)xoptions)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1167, (PyObject *)(xoptions)); } else _Py_Dealloc((PyObject *)(xoptions)); } while (0); } while (0); |
1168 | xoptions = PyDict_New(); |
1169 | } |
1170 | return xoptions; |
1171 | } |
1172 | |
1173 | void |
1174 | PySys_AddXOption(const wchar_t *s) |
1175 | { |
1176 | PyObject *opts; |
1177 | PyObject *name = NULL((void *)0), *value = NULL((void *)0); |
1178 | const wchar_t *name_end; |
1179 | int r; |
1180 | |
1181 | opts = get_xoptions(); |
1182 | if (opts == NULL((void *)0)) |
1183 | goto error; |
1184 | |
1185 | name_end = wcschr(s, L'='); |
1186 | if (!name_end) { |
1187 | name = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(s, -1); |
1188 | value = Py_True((PyObject *) &_Py_TrueStruct); |
1189 | Py_INCREF(value)( _Py_RefTotal++ , ((PyObject*)(value))->ob_refcnt++); |
1190 | } |
1191 | else { |
1192 | name = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(s, name_end - s); |
1193 | value = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(name_end + 1, -1); |
1194 | } |
1195 | if (name == NULL((void *)0) || value == NULL((void *)0)) |
1196 | goto error; |
1197 | r = PyDict_SetItem(opts, name, value); |
Value stored to 'r' is never read | |
1198 | Py_DECREF(name)do { if (_Py_RefTotal-- , --((PyObject*)(name))->ob_refcnt != 0) { if (((PyObject*)name)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1198, (PyObject *)(name)); } else _Py_Dealloc ((PyObject *)(name)); } while (0); |
1199 | Py_DECREF(value)do { if (_Py_RefTotal-- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1199, (PyObject *)(value)); } else _Py_Dealloc ((PyObject *)(value)); } while (0); |
1200 | return; |
1201 | |
1202 | error: |
1203 | Py_XDECREF(name)do { if ((name) == ((void *)0)) ; else do { if (_Py_RefTotal-- , --((PyObject*)(name))->ob_refcnt != 0) { if (((PyObject *)name)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1203, (PyObject *)(name)); } else _Py_Dealloc((PyObject *)( name)); } while (0); } while (0); |
1204 | Py_XDECREF(value)do { if ((value) == ((void *)0)) ; else do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1204, (PyObject *)(value)); } else _Py_Dealloc((PyObject *) (value)); } while (0); } while (0); |
1205 | /* No return value, therefore clear error state if possible */ |
1206 | if (_Py_atomic_load_relaxed(&_PyThreadState_Current)__extension__ ({ __typeof__(&_PyThreadState_Current) atomic_val = &_PyThreadState_Current; __typeof__(atomic_val->_value ) result; volatile __typeof__(result) *volatile_data = &atomic_val ->_value; _Py_memory_order order = _Py_memory_order_relaxed ; _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); ; switch(order ) { case _Py_memory_order_release: case _Py_memory_order_acq_rel : case _Py_memory_order_seq_cst: _Py_atomic_thread_fence(_Py_memory_order_release ); break; default: break; } result = *volatile_data; switch(order ) { case _Py_memory_order_acquire: case _Py_memory_order_acq_rel : case _Py_memory_order_seq_cst: _Py_atomic_signal_fence(_Py_memory_order_acquire ); break; default: break; } ; result; })) |
1207 | PyErr_Clear(); |
1208 | } |
1209 | |
1210 | PyObject * |
1211 | PySys_GetXOptions(void) |
1212 | { |
1213 | return get_xoptions(); |
1214 | } |
1215 | |
1216 | /* XXX This doc string is too long to be a single string literal in VC++ 5.0. |
1217 | Two literals concatenated works just fine. If you have a K&R compiler |
1218 | or other abomination that however *does* understand longer strings, |
1219 | get rid of the !!! comment in the middle and the quotes that surround it. */ |
1220 | PyDoc_VAR(sys_doc)static char sys_doc[] = |
1221 | PyDoc_STR("This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1222 | "This module provides access to some objects used or maintained by the\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1223 | interpreter and to functions that interact strongly with the interpreter.\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1224 | \n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1225 | Dynamic objects:\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1226 | \n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1227 | argv -- command line arguments; argv[0] is the script pathname if known\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1228 | path -- module search path; path[0] is the script directory, else ''\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1229 | modules -- dictionary of loaded modules\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1230 | \n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1231 | displayhook -- called to show results in an interactive session\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1232 | excepthook -- called to handle any uncaught exception other than SystemExit\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1233 | To customize printing in an interactive session or to install a custom\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1234 | top-level exception handler, assign other functions to replace these.\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1235 | \n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1236 | stdin -- standard input file object; used by input()\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1237 | stdout -- standard output file object; used by print()\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1238 | stderr -- standard error object; used for error messages\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1239 | By assigning other file objects (or objects that behave like files)\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1240 | to these, it is possible to redirect all of the interpreter's I/O.\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1241 | \n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1242 | last_type -- type of last uncaught exception\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1243 | last_value -- value of last uncaught exception\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1244 | last_traceback -- traceback of last uncaught exception\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1245 | These three are only available in an interactive session after a\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1246 | traceback has been printed.\n\"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1247 | ""This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1248 | )"This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n" |
1249 | /* concatenating string here */ |
1250 | PyDoc_STR("\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1251 | "\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1252 | Static objects:\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1253 | \n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1254 | float_info -- a dict with information about the float implementation.\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1255 | int_info -- a struct sequence with information about the int implementation.\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1256 | maxsize -- the largest supported length of containers.\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1257 | maxunicode -- the largest supported character\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1258 | builtin_module_names -- tuple of module names built into this interpreter\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1259 | subversion -- subversion information of the build as tuple\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1260 | version -- the version of this interpreter as a string\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1261 | version_info -- version information as a named tuple\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1262 | hexversion -- version information encoded as a single integer\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1263 | copyright -- copyright notice pertaining to this interpreter\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1264 | platform -- platform identifier\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1265 | executable -- pathname of this Python interpreter\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1266 | prefix -- prefix used to find the Python library\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1267 | exec_prefix -- prefix used to find the machine-specific Python library\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1268 | float_repr_style -- string indicating the style of repr() output for floats\n\"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1269 | ""\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1270 | )"\nStatic objects:\n\nfloat_info -- a dict with information about the float implementation.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the largest supported character\nbuiltin_module_names -- tuple of module names built into this interpreter\nsubversion -- subversion information of the build as tuple\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\nhexversion -- version information encoded as a single integer\ncopyright -- copyright notice pertaining to this interpreter\nplatform -- platform identifier\nexecutable -- pathname of this Python interpreter\nprefix -- prefix used to find the Python library\nexec_prefix -- prefix used to find the machine-specific Python library\nfloat_repr_style -- string indicating the style of repr() output for floats\n" |
1271 | #ifdef MS_WINDOWS |
1272 | /* concatenating string here */ |
1273 | PyDoc_STR("dllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n" |
1274 | "dllhandle -- [Windows only] integer handle of the Python DLL\n\"dllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n" |
1275 | winver -- [Windows only] version number of the Python DLL\n\"dllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n" |
1276 | ""dllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n" |
1277 | )"dllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n" |
1278 | #endif /* MS_WINDOWS */ |
1279 | PyDoc_STR("__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1280 | "__stdin__ -- the original stdin; don't touch!\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1281 | __stdout__ -- the original stdout; don't touch!\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1282 | __stderr__ -- the original stderr; don't touch!\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1283 | __displayhook__ -- the original displayhook; don't touch!\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1284 | __excepthook__ -- the original excepthook; don't touch!\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1285 | \n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1286 | Functions:\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1287 | \n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1288 | displayhook() -- print an object to the screen, and save it in builtins._\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1289 | excepthook() -- print an exception and its traceback to sys.stderr\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1290 | exc_info() -- return thread-safe information about the current exception\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1291 | exit() -- exit the interpreter by raising SystemExit\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1292 | getdlopenflags() -- returns flags to be used for dlopen() calls\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1293 | getprofile() -- get the global profiling function\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1294 | getrefcount() -- return the reference count for an object (plus one :-)\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1295 | getrecursionlimit() -- return the max recursion depth for the interpreter\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1296 | getsizeof() -- return the size of an object in bytes\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1297 | gettrace() -- get the global debug tracing function\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1298 | setcheckinterval() -- control how often the interpreter checks for events\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1299 | setdlopenflags() -- set the flags to be used for dlopen() calls\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1300 | setprofile() -- set the global profiling function\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1301 | setrecursionlimit() -- set the max recursion depth for the interpreter\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1302 | settrace() -- set the global debug tracing function\n\"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1303 | ""__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1304 | )"__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" |
1305 | /* end of sys_doc */ ; |
1306 | |
1307 | /* Subversion branch and revision management */ |
1308 | static const char _patchlevel_revision[] = PY_PATCHLEVEL_REVISION"$Revision: 88276 $"; |
1309 | static const char headurl[] = "$HeadURL: svn+ssh://pythondev@svn.python.org/python/branches/py3k/Python/sysmodule.c $"; |
1310 | static int svn_initialized; |
1311 | static char patchlevel_revision[50]; /* Just the number */ |
1312 | static char branch[50]; |
1313 | static char shortbranch[50]; |
1314 | static const char *svn_revision; |
1315 | |
1316 | static void |
1317 | svnversion_init(void) |
1318 | { |
1319 | const char *python, *br_start, *br_end, *br_end2, *svnversion; |
1320 | Py_ssize_t len; |
1321 | int istag = 0; |
1322 | |
1323 | if (svn_initialized) |
1324 | return; |
1325 | |
1326 | python = strstr(headurl, "/python/"); |
1327 | if (!python) { |
1328 | strcpy(branch, "unknown branch")((__builtin_object_size (branch, 0) != (size_t) -1) ? __builtin___strcpy_chk (branch, "unknown branch", __builtin_object_size (branch, 2 > 1)) : __inline_strcpy_chk (branch, "unknown branch")); |
1329 | strcpy(shortbranch, "unknown")((__builtin_object_size (shortbranch, 0) != (size_t) -1) ? __builtin___strcpy_chk (shortbranch, "unknown", __builtin_object_size (shortbranch, 2 > 1)) : __inline_strcpy_chk (shortbranch, "unknown")); |
1330 | } |
1331 | else { |
1332 | br_start = python + 8; |
1333 | br_end = strchr(br_start, '/'); |
1334 | assert(br_end)(__builtin_expect(!(br_end), 0) ? __assert_rtn(__func__, "./Python/sysmodule.c" , 1334, "br_end") : (void)0); |
1335 | |
1336 | /* Works even for trunk, |
1337 | as we are in trunk/Python/sysmodule.c */ |
1338 | br_end2 = strchr(br_end+1, '/'); |
1339 | |
1340 | istag = strncmp(br_start, "tags", 4) == 0; |
1341 | if (strncmp(br_start, "trunk", 5) == 0) { |
1342 | strcpy(branch, "trunk")((__builtin_object_size (branch, 0) != (size_t) -1) ? __builtin___strcpy_chk (branch, "trunk", __builtin_object_size (branch, 2 > 1)) : __inline_strcpy_chk (branch, "trunk")); |
1343 | strcpy(shortbranch, "trunk")((__builtin_object_size (shortbranch, 0) != (size_t) -1) ? __builtin___strcpy_chk (shortbranch, "trunk", __builtin_object_size (shortbranch, 2 > 1)) : __inline_strcpy_chk (shortbranch, "trunk")); |
1344 | } |
1345 | else if (istag || strncmp(br_start, "branches", 8) == 0) { |
1346 | len = br_end2 - br_start; |
1347 | strncpy(branch, br_start, len)((__builtin_object_size (branch, 0) != (size_t) -1) ? __builtin___strncpy_chk (branch, br_start, len, __builtin_object_size (branch, 2 > 1)) : __inline_strncpy_chk (branch, br_start, len)); |
1348 | branch[len] = '\0'; |
1349 | |
1350 | len = br_end2 - (br_end + 1); |
1351 | strncpy(shortbranch, br_end + 1, len)((__builtin_object_size (shortbranch, 0) != (size_t) -1) ? __builtin___strncpy_chk (shortbranch, br_end + 1, len, __builtin_object_size (shortbranch , 2 > 1)) : __inline_strncpy_chk (shortbranch, br_end + 1, len)); |
1352 | shortbranch[len] = '\0'; |
1353 | } |
1354 | else { |
1355 | Py_FatalError("bad HeadURL"); |
1356 | return; |
1357 | } |
1358 | } |
1359 | |
1360 | |
1361 | svnversion = _Py_svnversion(); |
1362 | if (strcmp(svnversion, "Unversioned directory") != 0 && strcmp(svnversion, "exported") != 0) |
1363 | svn_revision = svnversion; |
1364 | else if (istag) { |
1365 | len = strlen(_patchlevel_revision); |
1366 | assert(len >= 13)(__builtin_expect(!(len >= 13), 0) ? __assert_rtn(__func__ , "./Python/sysmodule.c", 1366, "len >= 13") : (void)0); |
1367 | assert(len < (sizeof(patchlevel_revision) + 13))(__builtin_expect(!(len < (sizeof(patchlevel_revision) + 13 )), 0) ? __assert_rtn(__func__, "./Python/sysmodule.c", 1367, "len < (sizeof(patchlevel_revision) + 13)") : (void)0); |
1368 | strncpy(patchlevel_revision, _patchlevel_revision + 11,((__builtin_object_size (patchlevel_revision, 0) != (size_t) - 1) ? __builtin___strncpy_chk (patchlevel_revision, _patchlevel_revision + 11, len - 13, __builtin_object_size (patchlevel_revision, 2 > 1)) : __inline_strncpy_chk (patchlevel_revision, _patchlevel_revision + 11, len - 13)) |
1369 | len - 13)((__builtin_object_size (patchlevel_revision, 0) != (size_t) - 1) ? __builtin___strncpy_chk (patchlevel_revision, _patchlevel_revision + 11, len - 13, __builtin_object_size (patchlevel_revision, 2 > 1)) : __inline_strncpy_chk (patchlevel_revision, _patchlevel_revision + 11, len - 13)); |
1370 | patchlevel_revision[len - 13] = '\0'; |
1371 | svn_revision = patchlevel_revision; |
1372 | } |
1373 | else |
1374 | svn_revision = ""; |
1375 | |
1376 | svn_initialized = 1; |
1377 | } |
1378 | |
1379 | /* Return svnversion output if available. |
1380 | Else return Revision of patchlevel.h if on branch. |
1381 | Else return empty string */ |
1382 | const char* |
1383 | Py_SubversionRevision() |
1384 | { |
1385 | svnversion_init(); |
1386 | return svn_revision; |
1387 | } |
1388 | |
1389 | const char* |
1390 | Py_SubversionShortBranch() |
1391 | { |
1392 | svnversion_init(); |
1393 | return shortbranch; |
1394 | } |
1395 | |
1396 | |
1397 | PyDoc_STRVAR(flags__doc__,static char flags__doc__[] = "sys.flags\n\nFlags provided through command line arguments or environment vars." |
1398 | "sys.flags\n\static char flags__doc__[] = "sys.flags\n\nFlags provided through command line arguments or environment vars." |
1399 | \n\static char flags__doc__[] = "sys.flags\n\nFlags provided through command line arguments or environment vars." |
1400 | Flags provided through command line arguments or environment vars.")static char flags__doc__[] = "sys.flags\n\nFlags provided through command line arguments or environment vars."; |
1401 | |
1402 | static PyTypeObject FlagsType; |
1403 | |
1404 | static PyStructSequence_Field flags_fields[] = { |
1405 | {"debug", "-d"}, |
1406 | {"division_warning", "-Q"}, |
1407 | {"inspect", "-i"}, |
1408 | {"interactive", "-i"}, |
1409 | {"optimize", "-O or -OO"}, |
1410 | {"dont_write_bytecode", "-B"}, |
1411 | {"no_user_site", "-s"}, |
1412 | {"no_site", "-S"}, |
1413 | {"ignore_environment", "-E"}, |
1414 | {"verbose", "-v"}, |
1415 | #ifdef RISCOS |
1416 | {"riscos_wimp", "???"}, |
1417 | #endif |
1418 | /* {"unbuffered", "-u"}, */ |
1419 | /* {"skip_first", "-x"}, */ |
1420 | {"bytes_warning", "-b"}, |
1421 | {"quiet", "-q"}, |
1422 | {0} |
1423 | }; |
1424 | |
1425 | static PyStructSequence_Desc flags_desc = { |
1426 | "sys.flags", /* name */ |
1427 | flags__doc__, /* doc */ |
1428 | flags_fields, /* fields */ |
1429 | #ifdef RISCOS |
1430 | 13 |
1431 | #else |
1432 | 12 |
1433 | #endif |
1434 | }; |
1435 | |
1436 | static PyObject* |
1437 | make_flags(void) |
1438 | { |
1439 | int pos = 0; |
1440 | PyObject *seq; |
1441 | |
1442 | seq = PyStructSequence_New(&FlagsType); |
1443 | if (seq == NULL((void *)0)) |
1444 | return NULL((void *)0); |
1445 | |
1446 | #define SetFlag(flag) \ |
1447 | PyStructSequence_SET_ITEM(seq, pos++, PyLong_FromLong(flag))(((PyTupleObject *)(seq))->ob_item[pos++] = PyLong_FromLong (flag)) |
1448 | |
1449 | SetFlag(Py_DebugFlag); |
1450 | SetFlag(Py_DivisionWarningFlag); |
1451 | SetFlag(Py_InspectFlag); |
1452 | SetFlag(Py_InteractiveFlag); |
1453 | SetFlag(Py_OptimizeFlag); |
1454 | SetFlag(Py_DontWriteBytecodeFlag); |
1455 | SetFlag(Py_NoUserSiteDirectory); |
1456 | SetFlag(Py_NoSiteFlag); |
1457 | SetFlag(Py_IgnoreEnvironmentFlag); |
1458 | SetFlag(Py_VerboseFlag); |
1459 | #ifdef RISCOS |
1460 | SetFlag(Py_RISCOSWimpFlag); |
1461 | #endif |
1462 | /* SetFlag(saw_unbuffered_flag); */ |
1463 | /* SetFlag(skipfirstline); */ |
1464 | SetFlag(Py_BytesWarningFlag); |
1465 | SetFlag(Py_QuietFlag); |
1466 | #undef SetFlag |
1467 | |
1468 | if (PyErr_Occurred()) { |
1469 | return NULL((void *)0); |
1470 | } |
1471 | return seq; |
1472 | } |
1473 | |
1474 | PyDoc_STRVAR(version_info__doc__,static char version_info__doc__[] = "sys.version_info\n\nVersion information as a named tuple." |
1475 | "sys.version_info\n\static char version_info__doc__[] = "sys.version_info\n\nVersion information as a named tuple." |
1476 | \n\static char version_info__doc__[] = "sys.version_info\n\nVersion information as a named tuple." |
1477 | Version information as a named tuple.")static char version_info__doc__[] = "sys.version_info\n\nVersion information as a named tuple."; |
1478 | |
1479 | static PyTypeObject VersionInfoType; |
1480 | |
1481 | static PyStructSequence_Field version_info_fields[] = { |
1482 | {"major", "Major release number"}, |
1483 | {"minor", "Minor release number"}, |
1484 | {"micro", "Patch release number"}, |
1485 | {"releaselevel", "'alpha', 'beta', 'candidate', or 'release'"}, |
1486 | {"serial", "Serial release number"}, |
1487 | {0} |
1488 | }; |
1489 | |
1490 | static PyStructSequence_Desc version_info_desc = { |
1491 | "sys.version_info", /* name */ |
1492 | version_info__doc__, /* doc */ |
1493 | version_info_fields, /* fields */ |
1494 | 5 |
1495 | }; |
1496 | |
1497 | static PyObject * |
1498 | make_version_info(void) |
1499 | { |
1500 | PyObject *version_info; |
1501 | char *s; |
1502 | int pos = 0; |
1503 | |
1504 | version_info = PyStructSequence_New(&VersionInfoType); |
1505 | if (version_info == NULL((void *)0)) { |
1506 | return NULL((void *)0); |
1507 | } |
1508 | |
1509 | /* |
1510 | * These release level checks are mutually exclusive and cover |
1511 | * the field, so don't get too fancy with the pre-processor! |
1512 | */ |
1513 | #if PY_RELEASE_LEVEL0xC == PY_RELEASE_LEVEL_ALPHA0xA |
1514 | s = "alpha"; |
1515 | #elif PY_RELEASE_LEVEL0xC == PY_RELEASE_LEVEL_BETA0xB |
1516 | s = "beta"; |
1517 | #elif PY_RELEASE_LEVEL0xC == PY_RELEASE_LEVEL_GAMMA0xC |
1518 | s = "candidate"; |
1519 | #elif PY_RELEASE_LEVEL0xC == PY_RELEASE_LEVEL_FINAL0xF |
1520 | s = "final"; |
1521 | #endif |
1522 | |
1523 | #define SetIntItem(flag) \ |
1524 | PyStructSequence_SET_ITEM(version_info, pos++, PyLong_FromLong(flag))(((PyTupleObject *)(version_info))->ob_item[pos++] = PyLong_FromLong (flag)) |
1525 | #define SetStrItem(flag) \ |
1526 | PyStructSequence_SET_ITEM(version_info, pos++, PyUnicode_FromString(flag))(((PyTupleObject *)(version_info))->ob_item[pos++] = PyUnicodeUCS2_FromString (flag)) |
1527 | |
1528 | SetIntItem(PY_MAJOR_VERSION3); |
1529 | SetIntItem(PY_MINOR_VERSION2); |
1530 | SetIntItem(PY_MICRO_VERSION0); |
1531 | SetStrItem(s); |
1532 | SetIntItem(PY_RELEASE_SERIAL2); |
1533 | #undef SetIntItem |
1534 | #undef SetStrItem |
1535 | |
1536 | if (PyErr_Occurred()) { |
1537 | Py_CLEAR(version_info)do { if (version_info) { PyObject *_py_tmp = (PyObject *)(version_info ); (version_info) = ((void *)0); do { if (_Py_RefTotal-- , -- ((PyObject*)(_py_tmp))->ob_refcnt != 0) { if (((PyObject*) _py_tmp)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1537, (PyObject *)(_py_tmp)); } else _Py_Dealloc((PyObject * )(_py_tmp)); } while (0); } } while (0); |
1538 | return NULL((void *)0); |
1539 | } |
1540 | return version_info; |
1541 | } |
1542 | |
1543 | static struct PyModuleDef sysmodule = { |
1544 | PyModuleDef_HEAD_INIT{ { 0, 0, 1, ((void *)0) }, ((void *)0), 0, ((void *)0), }, |
1545 | "sys", |
1546 | sys_doc, |
1547 | -1, /* multiple "initialization" just copies the module dict. */ |
1548 | sys_methods, |
1549 | NULL((void *)0), |
1550 | NULL((void *)0), |
1551 | NULL((void *)0), |
1552 | NULL((void *)0) |
1553 | }; |
1554 | |
1555 | PyObject * |
1556 | _PySys_Init(void) |
1557 | { |
1558 | PyObject *m, *v, *sysdict; |
1559 | char *s; |
1560 | |
1561 | m = PyModule_Create(&sysmodule)PyModule_Create2TraceRefs(&sysmodule, 1013); |
1562 | if (m == NULL((void *)0)) |
1563 | return NULL((void *)0); |
1564 | sysdict = PyModule_GetDict(m); |
1565 | #define SET_SYS_FROM_STRING(key, value) \ |
1566 | v = value; \ |
1567 | if (v != NULL((void *)0)) \ |
1568 | PyDict_SetItemString(sysdict, key, v); \ |
1569 | Py_XDECREF(v)do { if ((v) == ((void *)0)) ; else do { if (_Py_RefTotal-- , --((PyObject*)(v))->ob_refcnt != 0) { if (((PyObject*)v)-> ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1569, (PyObject *)(v)); } else _Py_Dealloc((PyObject *)(v)) ; } while (0); } while (0) |
1570 | |
1571 | /* Check that stdin is not a directory |
1572 | Using shell redirection, you can redirect stdin to a directory, |
1573 | crashing the Python interpreter. Catch this common mistake here |
1574 | and output a useful error message. Note that under MS Windows, |
1575 | the shell already prevents that. */ |
1576 | #if !defined(MS_WINDOWS) |
1577 | { |
1578 | struct stat sb; |
1579 | if (fstat(fileno(stdin__stdinp), &sb) == 0 && |
1580 | S_ISDIR(sb.st_mode)(((sb.st_mode) & 0170000) == 0040000)) { |
1581 | /* There's nothing more we can do. */ |
1582 | /* Py_FatalError() will core dump, so just exit. */ |
1583 | PySys_WriteStderr("Python error: <stdin> is a directory, cannot continue\n"); |
1584 | exit(EXIT_FAILURE1); |
1585 | } |
1586 | } |
1587 | #endif |
1588 | |
1589 | /* stdin/stdout/stderr are now set by pythonrun.c */ |
1590 | |
1591 | PyDict_SetItemString(sysdict, "__displayhook__", |
1592 | PyDict_GetItemString(sysdict, "displayhook")); |
1593 | PyDict_SetItemString(sysdict, "__excepthook__", |
1594 | PyDict_GetItemString(sysdict, "excepthook")); |
1595 | SET_SYS_FROM_STRING("version", |
1596 | PyUnicode_FromStringPyUnicodeUCS2_FromString(Py_GetVersion())); |
1597 | SET_SYS_FROM_STRING("hexversion", |
1598 | PyLong_FromLong(PY_VERSION_HEX((3 << 24) | (2 << 16) | (0 << 8) | (0xC << 4) | (2 << 0)))); |
1599 | svnversion_init(); |
1600 | SET_SYS_FROM_STRING("subversion", |
1601 | Py_BuildValue("(sss)", "CPython", branch, |
1602 | svn_revision)); |
1603 | SET_SYS_FROM_STRING("dont_write_bytecode", |
1604 | PyBool_FromLong(Py_DontWriteBytecodeFlag)); |
1605 | SET_SYS_FROM_STRING("api_version", |
1606 | PyLong_FromLong(PYTHON_API_VERSION1013)); |
1607 | SET_SYS_FROM_STRING("copyright", |
1608 | PyUnicode_FromStringPyUnicodeUCS2_FromString(Py_GetCopyright())); |
1609 | SET_SYS_FROM_STRING("platform", |
1610 | PyUnicode_FromStringPyUnicodeUCS2_FromString(Py_GetPlatform())); |
1611 | SET_SYS_FROM_STRING("executable", |
1612 | PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar( |
1613 | Py_GetProgramFullPath(), -1)); |
1614 | SET_SYS_FROM_STRING("prefix", |
1615 | PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(Py_GetPrefix(), -1)); |
1616 | SET_SYS_FROM_STRING("exec_prefix", |
1617 | PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(Py_GetExecPrefix(), -1)); |
1618 | SET_SYS_FROM_STRING("maxsize", |
1619 | PyLong_FromSsize_t(PY_SSIZE_T_MAX((Py_ssize_t)(((size_t)-1)>>1)))); |
1620 | SET_SYS_FROM_STRING("float_info", |
1621 | PyFloat_GetInfo()); |
1622 | SET_SYS_FROM_STRING("int_info", |
1623 | PyLong_GetInfo()); |
1624 | /* initialize hash_info */ |
1625 | if (Hash_InfoType.tp_name == 0) |
1626 | PyStructSequence_InitType(&Hash_InfoType, &hash_info_desc); |
1627 | SET_SYS_FROM_STRING("hash_info", |
1628 | get_hash_info()); |
1629 | SET_SYS_FROM_STRING("maxunicode", |
1630 | PyLong_FromLong(PyUnicode_GetMaxPyUnicodeUCS2_GetMax())); |
1631 | SET_SYS_FROM_STRING("builtin_module_names", |
1632 | list_builtin_module_names()); |
1633 | { |
1634 | /* Assumes that longs are at least 2 bytes long. |
1635 | Should be safe! */ |
1636 | unsigned long number = 1; |
1637 | char *value; |
1638 | |
1639 | s = (char *) &number; |
1640 | if (s[0] == 0) |
1641 | value = "big"; |
1642 | else |
1643 | value = "little"; |
1644 | SET_SYS_FROM_STRING("byteorder", |
1645 | PyUnicode_FromStringPyUnicodeUCS2_FromString(value)); |
1646 | } |
1647 | #ifdef MS_COREDLL |
1648 | SET_SYS_FROM_STRING("dllhandle", |
1649 | PyLong_FromVoidPtr(PyWin_DLLhModule)); |
1650 | SET_SYS_FROM_STRING("winver", |
1651 | PyUnicode_FromStringPyUnicodeUCS2_FromString(PyWin_DLLVersionString)); |
1652 | #endif |
1653 | #ifdef ABIFLAGS"dm" |
1654 | SET_SYS_FROM_STRING("abiflags", |
1655 | PyUnicode_FromStringPyUnicodeUCS2_FromString(ABIFLAGS"dm")); |
1656 | #endif |
1657 | if (warnoptions == NULL((void *)0)) { |
1658 | warnoptions = PyList_New(0); |
1659 | } |
1660 | else { |
1661 | Py_INCREF(warnoptions)( _Py_RefTotal++ , ((PyObject*)(warnoptions))->ob_refcnt++ ); |
1662 | } |
1663 | if (warnoptions != NULL((void *)0)) { |
1664 | PyDict_SetItemString(sysdict, "warnoptions", warnoptions); |
1665 | } |
1666 | |
1667 | v = get_xoptions(); |
1668 | if (v != NULL((void *)0)) { |
1669 | PyDict_SetItemString(sysdict, "_xoptions", v); |
1670 | } |
1671 | |
1672 | /* version_info */ |
1673 | if (VersionInfoType.tp_name == 0) |
1674 | PyStructSequence_InitType(&VersionInfoType, &version_info_desc); |
1675 | SET_SYS_FROM_STRING("version_info", make_version_info()); |
1676 | /* prevent user from creating new instances */ |
1677 | VersionInfoType.tp_init = NULL((void *)0); |
1678 | VersionInfoType.tp_new = NULL((void *)0); |
1679 | |
1680 | /* flags */ |
1681 | if (FlagsType.tp_name == 0) |
1682 | PyStructSequence_InitType(&FlagsType, &flags_desc); |
1683 | SET_SYS_FROM_STRING("flags", make_flags()); |
1684 | /* prevent user from creating new instances */ |
1685 | FlagsType.tp_init = NULL((void *)0); |
1686 | FlagsType.tp_new = NULL((void *)0); |
1687 | |
1688 | |
1689 | #if defined(MS_WINDOWS) |
1690 | /* getwindowsversion */ |
1691 | if (WindowsVersionType.tp_name == 0) |
1692 | PyStructSequence_InitType(&WindowsVersionType, &windows_version_desc); |
1693 | /* prevent user from creating new instances */ |
1694 | WindowsVersionType.tp_init = NULL((void *)0); |
1695 | WindowsVersionType.tp_new = NULL((void *)0); |
1696 | #endif |
1697 | |
1698 | /* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */ |
1699 | #ifndef PY_NO_SHORT_FLOAT_REPR |
1700 | SET_SYS_FROM_STRING("float_repr_style", |
1701 | PyUnicode_FromStringPyUnicodeUCS2_FromString("short")); |
1702 | #else |
1703 | SET_SYS_FROM_STRING("float_repr_style", |
1704 | PyUnicode_FromStringPyUnicodeUCS2_FromString("legacy")); |
1705 | #endif |
1706 | |
1707 | #undef SET_SYS_FROM_STRING |
1708 | if (PyErr_Occurred()) |
1709 | return NULL((void *)0); |
1710 | return m; |
1711 | } |
1712 | |
1713 | static PyObject * |
1714 | makepathobject(const wchar_t *path, wchar_t delim) |
1715 | { |
1716 | int i, n; |
1717 | const wchar_t *p; |
1718 | PyObject *v, *w; |
1719 | |
1720 | n = 1; |
1721 | p = path; |
1722 | while ((p = wcschr(p, delim)) != NULL((void *)0)) { |
1723 | n++; |
1724 | p++; |
1725 | } |
1726 | v = PyList_New(n); |
1727 | if (v == NULL((void *)0)) |
1728 | return NULL((void *)0); |
1729 | for (i = 0; ; i++) { |
1730 | p = wcschr(path, delim); |
1731 | if (p == NULL((void *)0)) |
1732 | p = path + wcslen(path); /* End of string */ |
1733 | w = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(path, (Py_ssize_t)(p - path)); |
1734 | if (w == NULL((void *)0)) { |
1735 | Py_DECREF(v)do { if (_Py_RefTotal-- , --((PyObject*)(v))->ob_refcnt != 0) { if (((PyObject*)v)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1735, (PyObject *)(v)); } else _Py_Dealloc ((PyObject *)(v)); } while (0); |
1736 | return NULL((void *)0); |
1737 | } |
1738 | PyList_SetItem(v, i, w); |
1739 | if (*p == '\0') |
1740 | break; |
1741 | path = p+1; |
1742 | } |
1743 | return v; |
1744 | } |
1745 | |
1746 | void |
1747 | PySys_SetPath(const wchar_t *path) |
1748 | { |
1749 | PyObject *v; |
1750 | if ((v = makepathobject(path, DELIML':')) == NULL((void *)0)) |
1751 | Py_FatalError("can't create sys.path"); |
1752 | if (PySys_SetObject("path", v) != 0) |
1753 | Py_FatalError("can't assign sys.path"); |
1754 | Py_DECREF(v)do { if (_Py_RefTotal-- , --((PyObject*)(v))->ob_refcnt != 0) { if (((PyObject*)v)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1754, (PyObject *)(v)); } else _Py_Dealloc ((PyObject *)(v)); } while (0); |
1755 | } |
1756 | |
1757 | static PyObject * |
1758 | makeargvobject(int argc, wchar_t **argv) |
1759 | { |
1760 | PyObject *av; |
1761 | if (argc <= 0 || argv == NULL((void *)0)) { |
1762 | /* Ensure at least one (empty) argument is seen */ |
1763 | static wchar_t *empty_argv[1] = {L""}; |
1764 | argv = empty_argv; |
1765 | argc = 1; |
1766 | } |
1767 | av = PyList_New(argc); |
1768 | if (av != NULL((void *)0)) { |
1769 | int i; |
1770 | for (i = 0; i < argc; i++) { |
1771 | #ifdef __VMS |
1772 | PyObject *v; |
1773 | |
1774 | /* argv[0] is the script pathname if known */ |
1775 | if (i == 0) { |
1776 | char* fn = decc$translate_vms(argv[0]); |
1777 | if ((fn == (char *)0) || fn == (char *)-1) |
1778 | v = PyUnicode_FromStringPyUnicodeUCS2_FromString(argv[0]); |
1779 | else |
1780 | v = PyUnicode_FromStringPyUnicodeUCS2_FromString( |
1781 | decc$translate_vms(argv[0])); |
1782 | } else |
1783 | v = PyUnicode_FromStringPyUnicodeUCS2_FromString(argv[i]); |
1784 | #else |
1785 | PyObject *v = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(argv[i], -1); |
1786 | #endif |
1787 | if (v == NULL((void *)0)) { |
1788 | Py_DECREF(av)do { if (_Py_RefTotal-- , --((PyObject*)(av))->ob_refcnt != 0) { if (((PyObject*)av)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1788, (PyObject *)(av)); } else _Py_Dealloc ((PyObject *)(av)); } while (0); |
1789 | av = NULL((void *)0); |
1790 | break; |
1791 | } |
1792 | PyList_SetItem(av, i, v); |
1793 | } |
1794 | } |
1795 | return av; |
1796 | } |
1797 | |
1798 | #define _HAVE_SCRIPT_ARGUMENT(argc, argv)(argc > 0 && argv0 != ((void *)0) && wcscmp (argv0, L"-c") != 0 && wcscmp(argv0, L"-m") != 0) \ |
1799 | (argc > 0 && argv0 != NULL((void *)0) && \ |
1800 | wcscmp(argv0, L"-c") != 0 && wcscmp(argv0, L"-m") != 0) |
1801 | |
1802 | static void |
1803 | sys_update_path(int argc, wchar_t **argv) |
1804 | { |
1805 | wchar_t *argv0; |
1806 | wchar_t *p = NULL((void *)0); |
1807 | Py_ssize_t n = 0; |
1808 | PyObject *a; |
1809 | PyObject *path; |
1810 | #ifdef HAVE_READLINK1 |
1811 | wchar_t link[MAXPATHLEN1024+1]; |
1812 | wchar_t argv0copy[2*MAXPATHLEN1024+1]; |
1813 | int nr = 0; |
1814 | #endif |
1815 | #if defined(HAVE_REALPATH1) |
1816 | wchar_t fullpath[MAXPATHLEN1024]; |
1817 | #elif defined(MS_WINDOWS) && !defined(MS_WINCE) |
1818 | wchar_t fullpath[MAX_PATH]; |
1819 | #endif |
1820 | |
1821 | path = PySys_GetObject("path"); |
1822 | if (path == NULL((void *)0)) |
1823 | return; |
1824 | |
1825 | argv0 = argv[0]; |
1826 | |
1827 | #ifdef HAVE_READLINK1 |
1828 | if (_HAVE_SCRIPT_ARGUMENT(argc, argv)(argc > 0 && argv0 != ((void *)0) && wcscmp (argv0, L"-c") != 0 && wcscmp(argv0, L"-m") != 0)) |
1829 | nr = _Py_wreadlink(argv0, link, MAXPATHLEN1024); |
1830 | if (nr > 0) { |
1831 | /* It's a symlink */ |
1832 | link[nr] = '\0'; |
1833 | if (link[0] == SEPL'/') |
1834 | argv0 = link; /* Link to absolute path */ |
1835 | else if (wcschr(link, SEPL'/') == NULL((void *)0)) |
1836 | ; /* Link without path */ |
1837 | else { |
1838 | /* Must join(dirname(argv0), link) */ |
1839 | wchar_t *q = wcsrchr(argv0, SEPL'/'); |
1840 | if (q == NULL((void *)0)) |
1841 | argv0 = link; /* argv0 without path */ |
1842 | else { |
1843 | /* Must make a copy */ |
1844 | wcscpy(argv0copy, argv0); |
1845 | q = wcsrchr(argv0copy, SEPL'/'); |
1846 | wcscpy(q+1, link); |
1847 | argv0 = argv0copy; |
1848 | } |
1849 | } |
1850 | } |
1851 | #endif /* HAVE_READLINK */ |
1852 | #if SEPL'/' == '\\' /* Special case for MS filename syntax */ |
1853 | if (_HAVE_SCRIPT_ARGUMENT(argc, argv)(argc > 0 && argv0 != ((void *)0) && wcscmp (argv0, L"-c") != 0 && wcscmp(argv0, L"-m") != 0)) { |
1854 | wchar_t *q; |
1855 | #if defined(MS_WINDOWS) && !defined(MS_WINCE) |
1856 | /* This code here replaces the first element in argv with the full |
1857 | path that it represents. Under CE, there are no relative paths so |
1858 | the argument must be the full path anyway. */ |
1859 | wchar_t *ptemp; |
1860 | if (GetFullPathNameW(argv0, |
1861 | sizeof(fullpath)/sizeof(fullpath[0]), |
1862 | fullpath, |
1863 | &ptemp)) { |
1864 | argv0 = fullpath; |
1865 | } |
1866 | #endif |
1867 | p = wcsrchr(argv0, SEPL'/'); |
1868 | /* Test for alternate separator */ |
1869 | q = wcsrchr(p ? p : argv0, '/'); |
1870 | if (q != NULL((void *)0)) |
1871 | p = q; |
1872 | if (p != NULL((void *)0)) { |
1873 | n = p + 1 - argv0; |
1874 | if (n > 1 && p[-1] != ':') |
1875 | n--; /* Drop trailing separator */ |
1876 | } |
1877 | } |
1878 | #else /* All other filename syntaxes */ |
1879 | if (_HAVE_SCRIPT_ARGUMENT(argc, argv)(argc > 0 && argv0 != ((void *)0) && wcscmp (argv0, L"-c") != 0 && wcscmp(argv0, L"-m") != 0)) { |
1880 | #if defined(HAVE_REALPATH1) |
1881 | if (_Py_wrealpath(argv0, fullpath, PATH_MAX1024)) { |
1882 | argv0 = fullpath; |
1883 | } |
1884 | #endif |
1885 | p = wcsrchr(argv0, SEPL'/'); |
1886 | } |
1887 | if (p != NULL((void *)0)) { |
1888 | n = p + 1 - argv0; |
1889 | #if SEPL'/' == '/' /* Special case for Unix filename syntax */ |
1890 | if (n > 1) |
1891 | n--; /* Drop trailing separator */ |
1892 | #endif /* Unix */ |
1893 | } |
1894 | #endif /* All others */ |
1895 | a = PyUnicode_FromWideCharPyUnicodeUCS2_FromWideChar(argv0, n); |
1896 | if (a == NULL((void *)0)) |
1897 | Py_FatalError("no mem for sys.path insertion"); |
1898 | if (PyList_Insert(path, 0, a) < 0) |
1899 | Py_FatalError("sys.path.insert(0) failed"); |
1900 | Py_DECREF(a)do { if (_Py_RefTotal-- , --((PyObject*)(a))->ob_refcnt != 0) { if (((PyObject*)a)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1900, (PyObject *)(a)); } else _Py_Dealloc ((PyObject *)(a)); } while (0); |
1901 | } |
1902 | |
1903 | void |
1904 | PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) |
1905 | { |
1906 | PyObject *av = makeargvobject(argc, argv); |
1907 | if (av == NULL((void *)0)) |
1908 | Py_FatalError("no mem for sys.argv"); |
1909 | if (PySys_SetObject("argv", av) != 0) |
1910 | Py_FatalError("can't assign sys.argv"); |
1911 | Py_DECREF(av)do { if (_Py_RefTotal-- , --((PyObject*)(av))->ob_refcnt != 0) { if (((PyObject*)av)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1911, (PyObject *)(av)); } else _Py_Dealloc ((PyObject *)(av)); } while (0); |
1912 | if (updatepath) |
1913 | sys_update_path(argc, argv); |
1914 | } |
1915 | |
1916 | void |
1917 | PySys_SetArgv(int argc, wchar_t **argv) |
1918 | { |
1919 | PySys_SetArgvEx(argc, argv, 1); |
1920 | } |
1921 | |
1922 | /* Reimplementation of PyFile_WriteString() no calling indirectly |
1923 | PyErr_CheckSignals(): avoid the call to PyObject_Str(). */ |
1924 | |
1925 | static int |
1926 | sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) |
1927 | { |
1928 | PyObject *writer = NULL((void *)0), *args = NULL((void *)0), *result = NULL((void *)0); |
1929 | int err; |
1930 | |
1931 | if (file == NULL((void *)0)) |
1932 | return -1; |
1933 | |
1934 | writer = PyObject_GetAttrString(file, "write"); |
1935 | if (writer == NULL((void *)0)) |
1936 | goto error; |
1937 | |
1938 | args = PyTuple_Pack(1, unicode); |
1939 | if (args == NULL((void *)0)) |
1940 | goto error; |
1941 | |
1942 | result = PyEval_CallObject(writer, args)PyEval_CallObjectWithKeywords(writer, args, (PyObject *)((void *)0)); |
1943 | if (result == NULL((void *)0)) { |
1944 | goto error; |
1945 | } else { |
1946 | err = 0; |
1947 | goto finally; |
1948 | } |
1949 | |
1950 | error: |
1951 | err = -1; |
1952 | finally: |
1953 | Py_XDECREF(writer)do { if ((writer) == ((void *)0)) ; else do { if (_Py_RefTotal -- , --((PyObject*)(writer))->ob_refcnt != 0) { if (((PyObject *)writer)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1953, (PyObject *)(writer)); } else _Py_Dealloc((PyObject * )(writer)); } while (0); } while (0); |
1954 | Py_XDECREF(args)do { if ((args) == ((void *)0)) ; else do { if (_Py_RefTotal-- , --((PyObject*)(args))->ob_refcnt != 0) { if (((PyObject *)args)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1954, (PyObject *)(args)); } else _Py_Dealloc((PyObject *)( args)); } while (0); } while (0); |
1955 | Py_XDECREF(result)do { if ((result) == ((void *)0)) ; else do { if (_Py_RefTotal -- , --((PyObject*)(result))->ob_refcnt != 0) { if (((PyObject *)result)->ob_refcnt < 0) _Py_NegativeRefcount("./Python/sysmodule.c" , 1955, (PyObject *)(result)); } else _Py_Dealloc((PyObject * )(result)); } while (0); } while (0); |
1956 | return err; |
1957 | } |
1958 | |
1959 | static int |
1960 | sys_pyfile_write(const char *text, PyObject *file) |
1961 | { |
1962 | PyObject *unicode = NULL((void *)0); |
1963 | int err; |
1964 | |
1965 | if (file == NULL((void *)0)) |
1966 | return -1; |
1967 | |
1968 | unicode = PyUnicode_FromStringPyUnicodeUCS2_FromString(text); |
1969 | if (unicode == NULL((void *)0)) |
1970 | return -1; |
1971 | |
1972 | err = sys_pyfile_write_unicode(unicode, file); |
1973 | Py_DECREF(unicode)do { if (_Py_RefTotal-- , --((PyObject*)(unicode))->ob_refcnt != 0) { if (((PyObject*)unicode)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 1973, (PyObject *)(unicode)); } else _Py_Dealloc((PyObject *)(unicode)); } while (0); |
1974 | return err; |
1975 | } |
1976 | |
1977 | /* APIs to write to sys.stdout or sys.stderr using a printf-like interface. |
1978 | Adapted from code submitted by Just van Rossum. |
1979 | |
1980 | PySys_WriteStdout(format, ...) |
1981 | PySys_WriteStderr(format, ...) |
1982 | |
1983 | The first function writes to sys.stdout; the second to sys.stderr. When |
1984 | there is a problem, they write to the real (C level) stdout or stderr; |
1985 | no exceptions are raised. |
1986 | |
1987 | PyErr_CheckSignals() is not called to avoid the execution of the Python |
1988 | signal handlers: they may raise a new exception whereas sys_write() |
1989 | ignores all exceptions. |
1990 | |
1991 | Both take a printf-style format string as their first argument followed |
1992 | by a variable length argument list determined by the format string. |
1993 | |
1994 | *** WARNING *** |
1995 | |
1996 | The format should limit the total size of the formatted output string to |
1997 | 1000 bytes. In particular, this means that no unrestricted "%s" formats |
1998 | should occur; these should be limited using "%.<N>s where <N> is a |
1999 | decimal number calculated so that <N> plus the maximum size of other |
2000 | formatted text does not exceed 1000 bytes. Also watch out for "%f", |
2001 | which can print hundreds of digits for very large numbers. |
2002 | |
2003 | */ |
2004 | |
2005 | static void |
2006 | sys_write(char *name, FILE *fp, const char *format, va_list va) |
2007 | { |
2008 | PyObject *file; |
2009 | PyObject *error_type, *error_value, *error_traceback; |
2010 | char buffer[1001]; |
2011 | int written; |
2012 | |
2013 | PyErr_Fetch(&error_type, &error_value, &error_traceback); |
2014 | file = PySys_GetObject(name); |
2015 | written = PyOS_vsnprintf(buffer, sizeof(buffer), format, va); |
2016 | if (sys_pyfile_write(buffer, file) != 0) { |
2017 | PyErr_Clear(); |
2018 | fputs(buffer, fp); |
2019 | } |
2020 | if (written < 0 || (size_t)written >= sizeof(buffer)) { |
2021 | const char *truncated = "... truncated"; |
2022 | if (sys_pyfile_write(truncated, file) != 0) |
2023 | fputs(truncated, fp); |
2024 | } |
2025 | PyErr_Restore(error_type, error_value, error_traceback); |
2026 | } |
2027 | |
2028 | void |
2029 | PySys_WriteStdout(const char *format, ...) |
2030 | { |
2031 | va_list va; |
2032 | |
2033 | va_start(va, format)__builtin_va_start(va, format); |
2034 | sys_write("stdout", stdout__stdoutp, format, va); |
2035 | va_end(va)__builtin_va_end(va); |
2036 | } |
2037 | |
2038 | void |
2039 | PySys_WriteStderr(const char *format, ...) |
2040 | { |
2041 | va_list va; |
2042 | |
2043 | va_start(va, format)__builtin_va_start(va, format); |
2044 | sys_write("stderr", stderr__stderrp, format, va); |
2045 | va_end(va)__builtin_va_end(va); |
2046 | } |
2047 | |
2048 | static void |
2049 | sys_format(char *name, FILE *fp, const char *format, va_list va) |
2050 | { |
2051 | PyObject *file, *message; |
2052 | PyObject *error_type, *error_value, *error_traceback; |
2053 | char *utf8; |
2054 | |
2055 | PyErr_Fetch(&error_type, &error_value, &error_traceback); |
2056 | file = PySys_GetObject(name); |
2057 | message = PyUnicode_FromFormatVPyUnicodeUCS2_FromFormatV(format, va); |
2058 | if (message != NULL((void *)0)) { |
2059 | if (sys_pyfile_write_unicode(message, file) != 0) { |
2060 | PyErr_Clear(); |
2061 | utf8 = _PyUnicode_AsString(message); |
2062 | if (utf8 != NULL((void *)0)) |
2063 | fputs(utf8, fp); |
2064 | } |
2065 | Py_DECREF(message)do { if (_Py_RefTotal-- , --((PyObject*)(message))->ob_refcnt != 0) { if (((PyObject*)message)->ob_refcnt < 0) _Py_NegativeRefcount ("./Python/sysmodule.c", 2065, (PyObject *)(message)); } else _Py_Dealloc((PyObject *)(message)); } while (0); |
2066 | } |
2067 | PyErr_Restore(error_type, error_value, error_traceback); |
2068 | } |
2069 | |
2070 | void |
2071 | PySys_FormatStdout(const char *format, ...) |
2072 | { |
2073 | va_list va; |
2074 | |
2075 | va_start(va, format)__builtin_va_start(va, format); |
2076 | sys_format("stdout", stdout__stdoutp, format, va); |
2077 | va_end(va)__builtin_va_end(va); |
2078 | } |
2079 | |
2080 | void |
2081 | PySys_FormatStderr(const char *format, ...) |
2082 | { |
2083 | va_list va; |
2084 | |
2085 | va_start(va, format)__builtin_va_start(va, format); |
2086 | sys_format("stderr", stderr__stderrp, format, va); |
2087 | va_end(va)__builtin_va_end(va); |
2088 | } |