Line data Source code
1 : /*[clinic input]
2 : preserve
3 : [clinic start generated code]*/
4 :
5 : PyDoc_STRVAR(sys_addaudithook__doc__,
6 : "addaudithook($module, /, hook)\n"
7 : "--\n"
8 : "\n"
9 : "Adds a new audit hook callback.");
10 :
11 : #define SYS_ADDAUDITHOOK_METHODDEF \
12 : {"addaudithook", _PyCFunction_CAST(sys_addaudithook), METH_FASTCALL|METH_KEYWORDS, sys_addaudithook__doc__},
13 :
14 : static PyObject *
15 : sys_addaudithook_impl(PyObject *module, PyObject *hook);
16 :
17 : static PyObject *
18 535 : sys_addaudithook(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
19 : {
20 535 : PyObject *return_value = NULL;
21 : static const char * const _keywords[] = {"hook", NULL};
22 : static _PyArg_Parser _parser = {NULL, _keywords, "addaudithook", 0};
23 : PyObject *argsbuf[1];
24 : PyObject *hook;
25 :
26 535 : args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
27 535 : if (!args) {
28 0 : goto exit;
29 : }
30 535 : hook = args[0];
31 535 : return_value = sys_addaudithook_impl(module, hook);
32 :
33 535 : exit:
34 535 : return return_value;
35 : }
36 :
37 : PyDoc_STRVAR(sys_displayhook__doc__,
38 : "displayhook($module, object, /)\n"
39 : "--\n"
40 : "\n"
41 : "Print an object to sys.stdout and also save it in builtins._");
42 :
43 : #define SYS_DISPLAYHOOK_METHODDEF \
44 : {"displayhook", (PyCFunction)sys_displayhook, METH_O, sys_displayhook__doc__},
45 :
46 : PyDoc_STRVAR(sys_excepthook__doc__,
47 : "excepthook($module, exctype, value, traceback, /)\n"
48 : "--\n"
49 : "\n"
50 : "Handle an exception by displaying it with a traceback on sys.stderr.");
51 :
52 : #define SYS_EXCEPTHOOK_METHODDEF \
53 : {"excepthook", _PyCFunction_CAST(sys_excepthook), METH_FASTCALL, sys_excepthook__doc__},
54 :
55 : static PyObject *
56 : sys_excepthook_impl(PyObject *module, PyObject *exctype, PyObject *value,
57 : PyObject *traceback);
58 :
59 : static PyObject *
60 267 : sys_excepthook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
61 : {
62 267 : PyObject *return_value = NULL;
63 : PyObject *exctype;
64 : PyObject *value;
65 : PyObject *traceback;
66 :
67 267 : if (!_PyArg_CheckPositional("excepthook", nargs, 3, 3)) {
68 1 : goto exit;
69 : }
70 266 : exctype = args[0];
71 266 : value = args[1];
72 266 : traceback = args[2];
73 266 : return_value = sys_excepthook_impl(module, exctype, value, traceback);
74 :
75 267 : exit:
76 267 : return return_value;
77 : }
78 :
79 : PyDoc_STRVAR(sys_exception__doc__,
80 : "exception($module, /)\n"
81 : "--\n"
82 : "\n"
83 : "Return the current exception.\n"
84 : "\n"
85 : "Return the most recent exception caught by an except clause\n"
86 : "in the current stack frame or in an older stack frame, or None\n"
87 : "if no such exception exists.");
88 :
89 : #define SYS_EXCEPTION_METHODDEF \
90 : {"exception", (PyCFunction)sys_exception, METH_NOARGS, sys_exception__doc__},
91 :
92 : static PyObject *
93 : sys_exception_impl(PyObject *module);
94 :
95 : static PyObject *
96 6 : sys_exception(PyObject *module, PyObject *Py_UNUSED(ignored))
97 : {
98 6 : return sys_exception_impl(module);
99 : }
100 :
101 : PyDoc_STRVAR(sys_exc_info__doc__,
102 : "exc_info($module, /)\n"
103 : "--\n"
104 : "\n"
105 : "Return current exception information: (type, value, traceback).\n"
106 : "\n"
107 : "Return information about the most recent exception caught by an except\n"
108 : "clause in the current stack frame or in an older stack frame.");
109 :
110 : #define SYS_EXC_INFO_METHODDEF \
111 : {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, sys_exc_info__doc__},
112 :
113 : static PyObject *
114 : sys_exc_info_impl(PyObject *module);
115 :
116 : static PyObject *
117 11307 : sys_exc_info(PyObject *module, PyObject *Py_UNUSED(ignored))
118 : {
119 11307 : return sys_exc_info_impl(module);
120 : }
121 :
122 : PyDoc_STRVAR(sys_unraisablehook__doc__,
123 : "unraisablehook($module, unraisable, /)\n"
124 : "--\n"
125 : "\n"
126 : "Handle an unraisable exception.\n"
127 : "\n"
128 : "The unraisable argument has the following attributes:\n"
129 : "\n"
130 : "* exc_type: Exception type.\n"
131 : "* exc_value: Exception value, can be None.\n"
132 : "* exc_traceback: Exception traceback, can be None.\n"
133 : "* err_msg: Error message, can be None.\n"
134 : "* object: Object causing the exception, can be None.");
135 :
136 : #define SYS_UNRAISABLEHOOK_METHODDEF \
137 : {"unraisablehook", (PyCFunction)sys_unraisablehook, METH_O, sys_unraisablehook__doc__},
138 :
139 : PyDoc_STRVAR(sys_exit__doc__,
140 : "exit($module, status=None, /)\n"
141 : "--\n"
142 : "\n"
143 : "Exit the interpreter by raising SystemExit(status).\n"
144 : "\n"
145 : "If the status is omitted or None, it defaults to zero (i.e., success).\n"
146 : "If the status is an integer, it will be used as the system exit status.\n"
147 : "If it is another kind of object, it will be printed and the system\n"
148 : "exit status will be one (i.e., failure).");
149 :
150 : #define SYS_EXIT_METHODDEF \
151 : {"exit", _PyCFunction_CAST(sys_exit), METH_FASTCALL, sys_exit__doc__},
152 :
153 : static PyObject *
154 : sys_exit_impl(PyObject *module, PyObject *status);
155 :
156 : static PyObject *
157 4359 : sys_exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
158 : {
159 4359 : PyObject *return_value = NULL;
160 4359 : PyObject *status = Py_None;
161 :
162 4359 : if (!_PyArg_CheckPositional("exit", nargs, 0, 1)) {
163 1 : goto exit;
164 : }
165 4358 : if (nargs < 1) {
166 7 : goto skip_optional;
167 : }
168 4351 : status = args[0];
169 4358 : skip_optional:
170 4358 : return_value = sys_exit_impl(module, status);
171 :
172 4359 : exit:
173 4359 : return return_value;
174 : }
175 :
176 : PyDoc_STRVAR(sys_getdefaultencoding__doc__,
177 : "getdefaultencoding($module, /)\n"
178 : "--\n"
179 : "\n"
180 : "Return the current default encoding used by the Unicode implementation.");
181 :
182 : #define SYS_GETDEFAULTENCODING_METHODDEF \
183 : {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS, sys_getdefaultencoding__doc__},
184 :
185 : static PyObject *
186 : sys_getdefaultencoding_impl(PyObject *module);
187 :
188 : static PyObject *
189 23 : sys_getdefaultencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
190 : {
191 23 : return sys_getdefaultencoding_impl(module);
192 : }
193 :
194 : PyDoc_STRVAR(sys_getfilesystemencoding__doc__,
195 : "getfilesystemencoding($module, /)\n"
196 : "--\n"
197 : "\n"
198 : "Return the encoding used to convert Unicode filenames to OS filenames.");
199 :
200 : #define SYS_GETFILESYSTEMENCODING_METHODDEF \
201 : {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, METH_NOARGS, sys_getfilesystemencoding__doc__},
202 :
203 : static PyObject *
204 : sys_getfilesystemencoding_impl(PyObject *module);
205 :
206 : static PyObject *
207 10665 : sys_getfilesystemencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
208 : {
209 10665 : return sys_getfilesystemencoding_impl(module);
210 : }
211 :
212 : PyDoc_STRVAR(sys_getfilesystemencodeerrors__doc__,
213 : "getfilesystemencodeerrors($module, /)\n"
214 : "--\n"
215 : "\n"
216 : "Return the error mode used Unicode to OS filename conversion.");
217 :
218 : #define SYS_GETFILESYSTEMENCODEERRORS_METHODDEF \
219 : {"getfilesystemencodeerrors", (PyCFunction)sys_getfilesystemencodeerrors, METH_NOARGS, sys_getfilesystemencodeerrors__doc__},
220 :
221 : static PyObject *
222 : sys_getfilesystemencodeerrors_impl(PyObject *module);
223 :
224 : static PyObject *
225 4227 : sys_getfilesystemencodeerrors(PyObject *module, PyObject *Py_UNUSED(ignored))
226 : {
227 4227 : return sys_getfilesystemencodeerrors_impl(module);
228 : }
229 :
230 : PyDoc_STRVAR(sys_intern__doc__,
231 : "intern($module, string, /)\n"
232 : "--\n"
233 : "\n"
234 : "``Intern\'\' the given string.\n"
235 : "\n"
236 : "This enters the string in the (global) table of interned strings whose\n"
237 : "purpose is to speed up dictionary lookups. Return the string itself or\n"
238 : "the previously interned string object with the same value.");
239 :
240 : #define SYS_INTERN_METHODDEF \
241 : {"intern", (PyCFunction)sys_intern, METH_O, sys_intern__doc__},
242 :
243 : static PyObject *
244 : sys_intern_impl(PyObject *module, PyObject *s);
245 :
246 : static PyObject *
247 336659 : sys_intern(PyObject *module, PyObject *arg)
248 : {
249 336659 : PyObject *return_value = NULL;
250 : PyObject *s;
251 :
252 336659 : if (!PyUnicode_Check(arg)) {
253 0 : _PyArg_BadArgument("intern", "argument", "str", arg);
254 0 : goto exit;
255 : }
256 336659 : if (PyUnicode_READY(arg) == -1) {
257 0 : goto exit;
258 : }
259 336659 : s = arg;
260 336659 : return_value = sys_intern_impl(module, s);
261 :
262 336659 : exit:
263 336659 : return return_value;
264 : }
265 :
266 : PyDoc_STRVAR(sys_gettrace__doc__,
267 : "gettrace($module, /)\n"
268 : "--\n"
269 : "\n"
270 : "Return the global debug tracing function set with sys.settrace.\n"
271 : "\n"
272 : "See the debugger chapter in the library manual.");
273 :
274 : #define SYS_GETTRACE_METHODDEF \
275 : {"gettrace", (PyCFunction)sys_gettrace, METH_NOARGS, sys_gettrace__doc__},
276 :
277 : static PyObject *
278 : sys_gettrace_impl(PyObject *module);
279 :
280 : static PyObject *
281 3671 : sys_gettrace(PyObject *module, PyObject *Py_UNUSED(ignored))
282 : {
283 3671 : return sys_gettrace_impl(module);
284 : }
285 :
286 : PyDoc_STRVAR(sys_getprofile__doc__,
287 : "getprofile($module, /)\n"
288 : "--\n"
289 : "\n"
290 : "Return the profiling function set with sys.setprofile.\n"
291 : "\n"
292 : "See the profiler chapter in the library manual.");
293 :
294 : #define SYS_GETPROFILE_METHODDEF \
295 : {"getprofile", (PyCFunction)sys_getprofile, METH_NOARGS, sys_getprofile__doc__},
296 :
297 : static PyObject *
298 : sys_getprofile_impl(PyObject *module);
299 :
300 : static PyObject *
301 10 : sys_getprofile(PyObject *module, PyObject *Py_UNUSED(ignored))
302 : {
303 10 : return sys_getprofile_impl(module);
304 : }
305 :
306 : PyDoc_STRVAR(sys_setswitchinterval__doc__,
307 : "setswitchinterval($module, interval, /)\n"
308 : "--\n"
309 : "\n"
310 : "Set the ideal thread switching delay inside the Python interpreter.\n"
311 : "\n"
312 : "The actual frequency of switching threads can be lower if the\n"
313 : "interpreter executes long sequences of uninterruptible code\n"
314 : "(this is implementation-specific and workload-dependent).\n"
315 : "\n"
316 : "The parameter must represent the desired switching delay in seconds\n"
317 : "A typical value is 0.005 (5 milliseconds).");
318 :
319 : #define SYS_SETSWITCHINTERVAL_METHODDEF \
320 : {"setswitchinterval", (PyCFunction)sys_setswitchinterval, METH_O, sys_setswitchinterval__doc__},
321 :
322 : static PyObject *
323 : sys_setswitchinterval_impl(PyObject *module, double interval);
324 :
325 : static PyObject *
326 136 : sys_setswitchinterval(PyObject *module, PyObject *arg)
327 : {
328 136 : PyObject *return_value = NULL;
329 : double interval;
330 :
331 136 : if (PyFloat_CheckExact(arg)) {
332 135 : interval = PyFloat_AS_DOUBLE(arg);
333 : }
334 : else
335 : {
336 1 : interval = PyFloat_AsDouble(arg);
337 1 : if (interval == -1.0 && PyErr_Occurred()) {
338 1 : goto exit;
339 : }
340 : }
341 135 : return_value = sys_setswitchinterval_impl(module, interval);
342 :
343 136 : exit:
344 136 : return return_value;
345 : }
346 :
347 : PyDoc_STRVAR(sys_getswitchinterval__doc__,
348 : "getswitchinterval($module, /)\n"
349 : "--\n"
350 : "\n"
351 : "Return the current thread switch interval; see sys.setswitchinterval().");
352 :
353 : #define SYS_GETSWITCHINTERVAL_METHODDEF \
354 : {"getswitchinterval", (PyCFunction)sys_getswitchinterval, METH_NOARGS, sys_getswitchinterval__doc__},
355 :
356 : static double
357 : sys_getswitchinterval_impl(PyObject *module);
358 :
359 : static PyObject *
360 20 : sys_getswitchinterval(PyObject *module, PyObject *Py_UNUSED(ignored))
361 : {
362 20 : PyObject *return_value = NULL;
363 : double _return_value;
364 :
365 20 : _return_value = sys_getswitchinterval_impl(module);
366 20 : if ((_return_value == -1.0) && PyErr_Occurred()) {
367 0 : goto exit;
368 : }
369 20 : return_value = PyFloat_FromDouble(_return_value);
370 :
371 20 : exit:
372 20 : return return_value;
373 : }
374 :
375 : PyDoc_STRVAR(sys_setrecursionlimit__doc__,
376 : "setrecursionlimit($module, limit, /)\n"
377 : "--\n"
378 : "\n"
379 : "Set the maximum depth of the Python interpreter stack to n.\n"
380 : "\n"
381 : "This limit prevents infinite recursion from causing an overflow of the C\n"
382 : "stack and crashing Python. The highest possible limit is platform-\n"
383 : "dependent.");
384 :
385 : #define SYS_SETRECURSIONLIMIT_METHODDEF \
386 : {"setrecursionlimit", (PyCFunction)sys_setrecursionlimit, METH_O, sys_setrecursionlimit__doc__},
387 :
388 : static PyObject *
389 : sys_setrecursionlimit_impl(PyObject *module, int new_limit);
390 :
391 : static PyObject *
392 138 : sys_setrecursionlimit(PyObject *module, PyObject *arg)
393 : {
394 138 : PyObject *return_value = NULL;
395 : int new_limit;
396 :
397 138 : new_limit = _PyLong_AsInt(arg);
398 138 : if (new_limit == -1 && PyErr_Occurred()) {
399 0 : goto exit;
400 : }
401 138 : return_value = sys_setrecursionlimit_impl(module, new_limit);
402 :
403 138 : exit:
404 138 : return return_value;
405 : }
406 :
407 : PyDoc_STRVAR(sys_set_coroutine_origin_tracking_depth__doc__,
408 : "set_coroutine_origin_tracking_depth($module, /, depth)\n"
409 : "--\n"
410 : "\n"
411 : "Enable or disable origin tracking for coroutine objects in this thread.\n"
412 : "\n"
413 : "Coroutine objects will track \'depth\' frames of traceback information\n"
414 : "about where they came from, available in their cr_origin attribute.\n"
415 : "\n"
416 : "Set a depth of 0 to disable.");
417 :
418 : #define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \
419 : {"set_coroutine_origin_tracking_depth", _PyCFunction_CAST(sys_set_coroutine_origin_tracking_depth), METH_FASTCALL|METH_KEYWORDS, sys_set_coroutine_origin_tracking_depth__doc__},
420 :
421 : static PyObject *
422 : sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth);
423 :
424 : static PyObject *
425 2458 : sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
426 : {
427 2458 : PyObject *return_value = NULL;
428 : static const char * const _keywords[] = {"depth", NULL};
429 : static _PyArg_Parser _parser = {NULL, _keywords, "set_coroutine_origin_tracking_depth", 0};
430 : PyObject *argsbuf[1];
431 : int depth;
432 :
433 2458 : args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
434 2458 : if (!args) {
435 0 : goto exit;
436 : }
437 2458 : depth = _PyLong_AsInt(args[0]);
438 2458 : if (depth == -1 && PyErr_Occurred()) {
439 0 : goto exit;
440 : }
441 2458 : return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth);
442 :
443 2458 : exit:
444 2458 : return return_value;
445 : }
446 :
447 : PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__,
448 : "get_coroutine_origin_tracking_depth($module, /)\n"
449 : "--\n"
450 : "\n"
451 : "Check status of origin tracking for coroutine objects in this thread.");
452 :
453 : #define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \
454 : {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__},
455 :
456 : static int
457 : sys_get_coroutine_origin_tracking_depth_impl(PyObject *module);
458 :
459 : static PyObject *
460 1233 : sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored))
461 : {
462 1233 : PyObject *return_value = NULL;
463 : int _return_value;
464 :
465 1233 : _return_value = sys_get_coroutine_origin_tracking_depth_impl(module);
466 1233 : if ((_return_value == -1) && PyErr_Occurred()) {
467 0 : goto exit;
468 : }
469 1233 : return_value = PyLong_FromLong((long)_return_value);
470 :
471 1233 : exit:
472 1233 : return return_value;
473 : }
474 :
475 : PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__,
476 : "get_asyncgen_hooks($module, /)\n"
477 : "--\n"
478 : "\n"
479 : "Return the installed asynchronous generators hooks.\n"
480 : "\n"
481 : "This returns a namedtuple of the form (firstiter, finalizer).");
482 :
483 : #define SYS_GET_ASYNCGEN_HOOKS_METHODDEF \
484 : {"get_asyncgen_hooks", (PyCFunction)sys_get_asyncgen_hooks, METH_NOARGS, sys_get_asyncgen_hooks__doc__},
485 :
486 : static PyObject *
487 : sys_get_asyncgen_hooks_impl(PyObject *module);
488 :
489 : static PyObject *
490 5261 : sys_get_asyncgen_hooks(PyObject *module, PyObject *Py_UNUSED(ignored))
491 : {
492 5261 : return sys_get_asyncgen_hooks_impl(module);
493 : }
494 :
495 : PyDoc_STRVAR(sys_getrecursionlimit__doc__,
496 : "getrecursionlimit($module, /)\n"
497 : "--\n"
498 : "\n"
499 : "Return the current value of the recursion limit.\n"
500 : "\n"
501 : "The recursion limit is the maximum depth of the Python interpreter\n"
502 : "stack. This limit prevents infinite recursion from causing an overflow\n"
503 : "of the C stack and crashing Python.");
504 :
505 : #define SYS_GETRECURSIONLIMIT_METHODDEF \
506 : {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, sys_getrecursionlimit__doc__},
507 :
508 : static PyObject *
509 : sys_getrecursionlimit_impl(PyObject *module);
510 :
511 : static PyObject *
512 9835 : sys_getrecursionlimit(PyObject *module, PyObject *Py_UNUSED(ignored))
513 : {
514 9835 : return sys_getrecursionlimit_impl(module);
515 : }
516 :
517 : #if defined(MS_WINDOWS)
518 :
519 : PyDoc_STRVAR(sys_getwindowsversion__doc__,
520 : "getwindowsversion($module, /)\n"
521 : "--\n"
522 : "\n"
523 : "Return info about the running version of Windows as a named tuple.\n"
524 : "\n"
525 : "The members are named: major, minor, build, platform, service_pack,\n"
526 : "service_pack_major, service_pack_minor, suite_mask, product_type and\n"
527 : "platform_version. For backward compatibility, only the first 5 items\n"
528 : "are available by indexing. All elements are numbers, except\n"
529 : "service_pack and platform_type which are strings, and platform_version\n"
530 : "which is a 3-tuple. Platform is always 2. Product_type may be 1 for a\n"
531 : "workstation, 2 for a domain controller, 3 for a server.\n"
532 : "Platform_version is a 3-tuple containing a version number that is\n"
533 : "intended for identifying the OS rather than feature detection.");
534 :
535 : #define SYS_GETWINDOWSVERSION_METHODDEF \
536 : {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, sys_getwindowsversion__doc__},
537 :
538 : static PyObject *
539 : sys_getwindowsversion_impl(PyObject *module);
540 :
541 : static PyObject *
542 : sys_getwindowsversion(PyObject *module, PyObject *Py_UNUSED(ignored))
543 : {
544 : return sys_getwindowsversion_impl(module);
545 : }
546 :
547 : #endif /* defined(MS_WINDOWS) */
548 :
549 : #if defined(MS_WINDOWS)
550 :
551 : PyDoc_STRVAR(sys__enablelegacywindowsfsencoding__doc__,
552 : "_enablelegacywindowsfsencoding($module, /)\n"
553 : "--\n"
554 : "\n"
555 : "Changes the default filesystem encoding to mbcs:replace.\n"
556 : "\n"
557 : "This is done for consistency with earlier versions of Python. See PEP\n"
558 : "529 for more information.\n"
559 : "\n"
560 : "This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING\n"
561 : "environment variable before launching Python.");
562 :
563 : #define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF \
564 : {"_enablelegacywindowsfsencoding", (PyCFunction)sys__enablelegacywindowsfsencoding, METH_NOARGS, sys__enablelegacywindowsfsencoding__doc__},
565 :
566 : static PyObject *
567 : sys__enablelegacywindowsfsencoding_impl(PyObject *module);
568 :
569 : static PyObject *
570 : sys__enablelegacywindowsfsencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
571 : {
572 : return sys__enablelegacywindowsfsencoding_impl(module);
573 : }
574 :
575 : #endif /* defined(MS_WINDOWS) */
576 :
577 : #if defined(HAVE_DLOPEN)
578 :
579 : PyDoc_STRVAR(sys_setdlopenflags__doc__,
580 : "setdlopenflags($module, flags, /)\n"
581 : "--\n"
582 : "\n"
583 : "Set the flags used by the interpreter for dlopen calls.\n"
584 : "\n"
585 : "This is used, for example, when the interpreter loads extension\n"
586 : "modules. Among other things, this will enable a lazy resolving of\n"
587 : "symbols when importing a module, if called as sys.setdlopenflags(0).\n"
588 : "To share symbols across extension modules, call as\n"
589 : "sys.setdlopenflags(os.RTLD_GLOBAL). Symbolic names for the flag\n"
590 : "modules can be found in the os module (RTLD_xxx constants, e.g.\n"
591 : "os.RTLD_LAZY).");
592 :
593 : #define SYS_SETDLOPENFLAGS_METHODDEF \
594 : {"setdlopenflags", (PyCFunction)sys_setdlopenflags, METH_O, sys_setdlopenflags__doc__},
595 :
596 : static PyObject *
597 : sys_setdlopenflags_impl(PyObject *module, int new_val);
598 :
599 : static PyObject *
600 2 : sys_setdlopenflags(PyObject *module, PyObject *arg)
601 : {
602 2 : PyObject *return_value = NULL;
603 : int new_val;
604 :
605 2 : new_val = _PyLong_AsInt(arg);
606 2 : if (new_val == -1 && PyErr_Occurred()) {
607 0 : goto exit;
608 : }
609 2 : return_value = sys_setdlopenflags_impl(module, new_val);
610 :
611 2 : exit:
612 2 : return return_value;
613 : }
614 :
615 : #endif /* defined(HAVE_DLOPEN) */
616 :
617 : #if defined(HAVE_DLOPEN)
618 :
619 : PyDoc_STRVAR(sys_getdlopenflags__doc__,
620 : "getdlopenflags($module, /)\n"
621 : "--\n"
622 : "\n"
623 : "Return the current value of the flags that are used for dlopen calls.\n"
624 : "\n"
625 : "The flag constants are defined in the os module.");
626 :
627 : #define SYS_GETDLOPENFLAGS_METHODDEF \
628 : {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, sys_getdlopenflags__doc__},
629 :
630 : static PyObject *
631 : sys_getdlopenflags_impl(PyObject *module);
632 :
633 : static PyObject *
634 2 : sys_getdlopenflags(PyObject *module, PyObject *Py_UNUSED(ignored))
635 : {
636 2 : return sys_getdlopenflags_impl(module);
637 : }
638 :
639 : #endif /* defined(HAVE_DLOPEN) */
640 :
641 : #if defined(USE_MALLOPT)
642 :
643 : PyDoc_STRVAR(sys_mdebug__doc__,
644 : "mdebug($module, flag, /)\n"
645 : "--\n"
646 : "\n");
647 :
648 : #define SYS_MDEBUG_METHODDEF \
649 : {"mdebug", (PyCFunction)sys_mdebug, METH_O, sys_mdebug__doc__},
650 :
651 : static PyObject *
652 : sys_mdebug_impl(PyObject *module, int flag);
653 :
654 : static PyObject *
655 : sys_mdebug(PyObject *module, PyObject *arg)
656 : {
657 : PyObject *return_value = NULL;
658 : int flag;
659 :
660 : flag = _PyLong_AsInt(arg);
661 : if (flag == -1 && PyErr_Occurred()) {
662 : goto exit;
663 : }
664 : return_value = sys_mdebug_impl(module, flag);
665 :
666 : exit:
667 : return return_value;
668 : }
669 :
670 : #endif /* defined(USE_MALLOPT) */
671 :
672 : PyDoc_STRVAR(sys_getrefcount__doc__,
673 : "getrefcount($module, object, /)\n"
674 : "--\n"
675 : "\n"
676 : "Return the reference count of object.\n"
677 : "\n"
678 : "The count returned is generally one higher than you might expect,\n"
679 : "because it includes the (temporary) reference as an argument to\n"
680 : "getrefcount().");
681 :
682 : #define SYS_GETREFCOUNT_METHODDEF \
683 : {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, sys_getrefcount__doc__},
684 :
685 : static Py_ssize_t
686 : sys_getrefcount_impl(PyObject *module, PyObject *object);
687 :
688 : static PyObject *
689 221 : sys_getrefcount(PyObject *module, PyObject *object)
690 : {
691 221 : PyObject *return_value = NULL;
692 : Py_ssize_t _return_value;
693 :
694 221 : _return_value = sys_getrefcount_impl(module, object);
695 221 : if ((_return_value == -1) && PyErr_Occurred()) {
696 0 : goto exit;
697 : }
698 221 : return_value = PyLong_FromSsize_t(_return_value);
699 :
700 221 : exit:
701 221 : return return_value;
702 : }
703 :
704 : #if defined(Py_REF_DEBUG)
705 :
706 : PyDoc_STRVAR(sys_gettotalrefcount__doc__,
707 : "gettotalrefcount($module, /)\n"
708 : "--\n"
709 : "\n");
710 :
711 : #define SYS_GETTOTALREFCOUNT_METHODDEF \
712 : {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS, sys_gettotalrefcount__doc__},
713 :
714 : static Py_ssize_t
715 : sys_gettotalrefcount_impl(PyObject *module);
716 :
717 : static PyObject *
718 112 : sys_gettotalrefcount(PyObject *module, PyObject *Py_UNUSED(ignored))
719 : {
720 112 : PyObject *return_value = NULL;
721 : Py_ssize_t _return_value;
722 :
723 112 : _return_value = sys_gettotalrefcount_impl(module);
724 112 : if ((_return_value == -1) && PyErr_Occurred()) {
725 0 : goto exit;
726 : }
727 112 : return_value = PyLong_FromSsize_t(_return_value);
728 :
729 112 : exit:
730 112 : return return_value;
731 : }
732 :
733 : #endif /* defined(Py_REF_DEBUG) */
734 :
735 : PyDoc_STRVAR(sys__getquickenedcount__doc__,
736 : "_getquickenedcount($module, /)\n"
737 : "--\n"
738 : "\n");
739 :
740 : #define SYS__GETQUICKENEDCOUNT_METHODDEF \
741 : {"_getquickenedcount", (PyCFunction)sys__getquickenedcount, METH_NOARGS, sys__getquickenedcount__doc__},
742 :
743 : static Py_ssize_t
744 : sys__getquickenedcount_impl(PyObject *module);
745 :
746 : static PyObject *
747 12 : sys__getquickenedcount(PyObject *module, PyObject *Py_UNUSED(ignored))
748 : {
749 12 : PyObject *return_value = NULL;
750 : Py_ssize_t _return_value;
751 :
752 12 : _return_value = sys__getquickenedcount_impl(module);
753 12 : if ((_return_value == -1) && PyErr_Occurred()) {
754 0 : goto exit;
755 : }
756 12 : return_value = PyLong_FromSsize_t(_return_value);
757 :
758 12 : exit:
759 12 : return return_value;
760 : }
761 :
762 : PyDoc_STRVAR(sys_getallocatedblocks__doc__,
763 : "getallocatedblocks($module, /)\n"
764 : "--\n"
765 : "\n"
766 : "Return the number of memory blocks currently allocated.");
767 :
768 : #define SYS_GETALLOCATEDBLOCKS_METHODDEF \
769 : {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS, sys_getallocatedblocks__doc__},
770 :
771 : static Py_ssize_t
772 : sys_getallocatedblocks_impl(PyObject *module);
773 :
774 : static PyObject *
775 15 : sys_getallocatedblocks(PyObject *module, PyObject *Py_UNUSED(ignored))
776 : {
777 15 : PyObject *return_value = NULL;
778 : Py_ssize_t _return_value;
779 :
780 15 : _return_value = sys_getallocatedblocks_impl(module);
781 15 : if ((_return_value == -1) && PyErr_Occurred()) {
782 0 : goto exit;
783 : }
784 15 : return_value = PyLong_FromSsize_t(_return_value);
785 :
786 15 : exit:
787 15 : return return_value;
788 : }
789 :
790 : PyDoc_STRVAR(sys__getframe__doc__,
791 : "_getframe($module, depth=0, /)\n"
792 : "--\n"
793 : "\n"
794 : "Return a frame object from the call stack.\n"
795 : "\n"
796 : "If optional integer depth is given, return the frame object that many\n"
797 : "calls below the top of the stack. If that is deeper than the call\n"
798 : "stack, ValueError is raised. The default for depth is zero, returning\n"
799 : "the frame at the top of the call stack.\n"
800 : "\n"
801 : "This function should be used for internal and specialized purposes\n"
802 : "only.");
803 :
804 : #define SYS__GETFRAME_METHODDEF \
805 : {"_getframe", _PyCFunction_CAST(sys__getframe), METH_FASTCALL, sys__getframe__doc__},
806 :
807 : static PyObject *
808 : sys__getframe_impl(PyObject *module, int depth);
809 :
810 : static PyObject *
811 48025 : sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
812 : {
813 48025 : PyObject *return_value = NULL;
814 48025 : int depth = 0;
815 :
816 48025 : if (!_PyArg_CheckPositional("_getframe", nargs, 0, 1)) {
817 1 : goto exit;
818 : }
819 48024 : if (nargs < 1) {
820 2561 : goto skip_optional;
821 : }
822 45463 : depth = _PyLong_AsInt(args[0]);
823 45463 : if (depth == -1 && PyErr_Occurred()) {
824 0 : goto exit;
825 : }
826 45463 : skip_optional:
827 48024 : return_value = sys__getframe_impl(module, depth);
828 :
829 48025 : exit:
830 48025 : return return_value;
831 : }
832 :
833 : PyDoc_STRVAR(sys__current_frames__doc__,
834 : "_current_frames($module, /)\n"
835 : "--\n"
836 : "\n"
837 : "Return a dict mapping each thread\'s thread id to its current stack frame.\n"
838 : "\n"
839 : "This function should be used for specialized purposes only.");
840 :
841 : #define SYS__CURRENT_FRAMES_METHODDEF \
842 : {"_current_frames", (PyCFunction)sys__current_frames, METH_NOARGS, sys__current_frames__doc__},
843 :
844 : static PyObject *
845 : sys__current_frames_impl(PyObject *module);
846 :
847 : static PyObject *
848 1 : sys__current_frames(PyObject *module, PyObject *Py_UNUSED(ignored))
849 : {
850 1 : return sys__current_frames_impl(module);
851 : }
852 :
853 : PyDoc_STRVAR(sys__current_exceptions__doc__,
854 : "_current_exceptions($module, /)\n"
855 : "--\n"
856 : "\n"
857 : "Return a dict mapping each thread\'s identifier to its current raised exception.\n"
858 : "\n"
859 : "This function should be used for specialized purposes only.");
860 :
861 : #define SYS__CURRENT_EXCEPTIONS_METHODDEF \
862 : {"_current_exceptions", (PyCFunction)sys__current_exceptions, METH_NOARGS, sys__current_exceptions__doc__},
863 :
864 : static PyObject *
865 : sys__current_exceptions_impl(PyObject *module);
866 :
867 : static PyObject *
868 1 : sys__current_exceptions(PyObject *module, PyObject *Py_UNUSED(ignored))
869 : {
870 1 : return sys__current_exceptions_impl(module);
871 : }
872 :
873 : PyDoc_STRVAR(sys_call_tracing__doc__,
874 : "call_tracing($module, func, args, /)\n"
875 : "--\n"
876 : "\n"
877 : "Call func(*args), while tracing is enabled.\n"
878 : "\n"
879 : "The tracing state is saved, and restored afterwards. This is intended\n"
880 : "to be called from a debugger from a checkpoint, to recursively debug\n"
881 : "some other code.");
882 :
883 : #define SYS_CALL_TRACING_METHODDEF \
884 : {"call_tracing", _PyCFunction_CAST(sys_call_tracing), METH_FASTCALL, sys_call_tracing__doc__},
885 :
886 : static PyObject *
887 : sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs);
888 :
889 : static PyObject *
890 3 : sys_call_tracing(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
891 : {
892 3 : PyObject *return_value = NULL;
893 : PyObject *func;
894 : PyObject *funcargs;
895 :
896 3 : if (!_PyArg_CheckPositional("call_tracing", nargs, 2, 2)) {
897 0 : goto exit;
898 : }
899 3 : func = args[0];
900 3 : if (!PyTuple_Check(args[1])) {
901 1 : _PyArg_BadArgument("call_tracing", "argument 2", "tuple", args[1]);
902 1 : goto exit;
903 : }
904 2 : funcargs = args[1];
905 2 : return_value = sys_call_tracing_impl(module, func, funcargs);
906 :
907 3 : exit:
908 3 : return return_value;
909 : }
910 :
911 : PyDoc_STRVAR(sys__debugmallocstats__doc__,
912 : "_debugmallocstats($module, /)\n"
913 : "--\n"
914 : "\n"
915 : "Print summary info to stderr about the state of pymalloc\'s structures.\n"
916 : "\n"
917 : "In Py_DEBUG mode, also perform some expensive internal consistency\n"
918 : "checks.");
919 :
920 : #define SYS__DEBUGMALLOCSTATS_METHODDEF \
921 : {"_debugmallocstats", (PyCFunction)sys__debugmallocstats, METH_NOARGS, sys__debugmallocstats__doc__},
922 :
923 : static PyObject *
924 : sys__debugmallocstats_impl(PyObject *module);
925 :
926 : static PyObject *
927 1 : sys__debugmallocstats(PyObject *module, PyObject *Py_UNUSED(ignored))
928 : {
929 1 : return sys__debugmallocstats_impl(module);
930 : }
931 :
932 : PyDoc_STRVAR(sys__clear_type_cache__doc__,
933 : "_clear_type_cache($module, /)\n"
934 : "--\n"
935 : "\n"
936 : "Clear the internal type lookup cache.");
937 :
938 : #define SYS__CLEAR_TYPE_CACHE_METHODDEF \
939 : {"_clear_type_cache", (PyCFunction)sys__clear_type_cache, METH_NOARGS, sys__clear_type_cache__doc__},
940 :
941 : static PyObject *
942 : sys__clear_type_cache_impl(PyObject *module);
943 :
944 : static PyObject *
945 45 : sys__clear_type_cache(PyObject *module, PyObject *Py_UNUSED(ignored))
946 : {
947 45 : return sys__clear_type_cache_impl(module);
948 : }
949 :
950 : PyDoc_STRVAR(sys_is_finalizing__doc__,
951 : "is_finalizing($module, /)\n"
952 : "--\n"
953 : "\n"
954 : "Return True if Python is exiting.");
955 :
956 : #define SYS_IS_FINALIZING_METHODDEF \
957 : {"is_finalizing", (PyCFunction)sys_is_finalizing, METH_NOARGS, sys_is_finalizing__doc__},
958 :
959 : static PyObject *
960 : sys_is_finalizing_impl(PyObject *module);
961 :
962 : static PyObject *
963 1573 : sys_is_finalizing(PyObject *module, PyObject *Py_UNUSED(ignored))
964 : {
965 1573 : return sys_is_finalizing_impl(module);
966 : }
967 :
968 : #if defined(Py_STATS)
969 :
970 : PyDoc_STRVAR(sys__stats_on__doc__,
971 : "_stats_on($module, /)\n"
972 : "--\n"
973 : "\n"
974 : "Turns on stats gathering (stats gathering is on by default).");
975 :
976 : #define SYS__STATS_ON_METHODDEF \
977 : {"_stats_on", (PyCFunction)sys__stats_on, METH_NOARGS, sys__stats_on__doc__},
978 :
979 : static PyObject *
980 : sys__stats_on_impl(PyObject *module);
981 :
982 : static PyObject *
983 : sys__stats_on(PyObject *module, PyObject *Py_UNUSED(ignored))
984 : {
985 : return sys__stats_on_impl(module);
986 : }
987 :
988 : #endif /* defined(Py_STATS) */
989 :
990 : #if defined(Py_STATS)
991 :
992 : PyDoc_STRVAR(sys__stats_off__doc__,
993 : "_stats_off($module, /)\n"
994 : "--\n"
995 : "\n"
996 : "Turns off stats gathering (stats gathering is on by default).");
997 :
998 : #define SYS__STATS_OFF_METHODDEF \
999 : {"_stats_off", (PyCFunction)sys__stats_off, METH_NOARGS, sys__stats_off__doc__},
1000 :
1001 : static PyObject *
1002 : sys__stats_off_impl(PyObject *module);
1003 :
1004 : static PyObject *
1005 : sys__stats_off(PyObject *module, PyObject *Py_UNUSED(ignored))
1006 : {
1007 : return sys__stats_off_impl(module);
1008 : }
1009 :
1010 : #endif /* defined(Py_STATS) */
1011 :
1012 : #if defined(Py_STATS)
1013 :
1014 : PyDoc_STRVAR(sys__stats_clear__doc__,
1015 : "_stats_clear($module, /)\n"
1016 : "--\n"
1017 : "\n"
1018 : "Clears the stats.");
1019 :
1020 : #define SYS__STATS_CLEAR_METHODDEF \
1021 : {"_stats_clear", (PyCFunction)sys__stats_clear, METH_NOARGS, sys__stats_clear__doc__},
1022 :
1023 : static PyObject *
1024 : sys__stats_clear_impl(PyObject *module);
1025 :
1026 : static PyObject *
1027 : sys__stats_clear(PyObject *module, PyObject *Py_UNUSED(ignored))
1028 : {
1029 : return sys__stats_clear_impl(module);
1030 : }
1031 :
1032 : #endif /* defined(Py_STATS) */
1033 :
1034 : #if defined(Py_STATS)
1035 :
1036 : PyDoc_STRVAR(sys__stats_dump__doc__,
1037 : "_stats_dump($module, /)\n"
1038 : "--\n"
1039 : "\n"
1040 : "Dump stats to file, and clears the stats.");
1041 :
1042 : #define SYS__STATS_DUMP_METHODDEF \
1043 : {"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__},
1044 :
1045 : static PyObject *
1046 : sys__stats_dump_impl(PyObject *module);
1047 :
1048 : static PyObject *
1049 : sys__stats_dump(PyObject *module, PyObject *Py_UNUSED(ignored))
1050 : {
1051 : return sys__stats_dump_impl(module);
1052 : }
1053 :
1054 : #endif /* defined(Py_STATS) */
1055 :
1056 : #if defined(ANDROID_API_LEVEL)
1057 :
1058 : PyDoc_STRVAR(sys_getandroidapilevel__doc__,
1059 : "getandroidapilevel($module, /)\n"
1060 : "--\n"
1061 : "\n"
1062 : "Return the build time API version of Android as an integer.");
1063 :
1064 : #define SYS_GETANDROIDAPILEVEL_METHODDEF \
1065 : {"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS, sys_getandroidapilevel__doc__},
1066 :
1067 : static PyObject *
1068 : sys_getandroidapilevel_impl(PyObject *module);
1069 :
1070 : static PyObject *
1071 : sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
1072 : {
1073 : return sys_getandroidapilevel_impl(module);
1074 : }
1075 :
1076 : #endif /* defined(ANDROID_API_LEVEL) */
1077 :
1078 : #ifndef SYS_GETWINDOWSVERSION_METHODDEF
1079 : #define SYS_GETWINDOWSVERSION_METHODDEF
1080 : #endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */
1081 :
1082 : #ifndef SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF
1083 : #define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF
1084 : #endif /* !defined(SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF) */
1085 :
1086 : #ifndef SYS_SETDLOPENFLAGS_METHODDEF
1087 : #define SYS_SETDLOPENFLAGS_METHODDEF
1088 : #endif /* !defined(SYS_SETDLOPENFLAGS_METHODDEF) */
1089 :
1090 : #ifndef SYS_GETDLOPENFLAGS_METHODDEF
1091 : #define SYS_GETDLOPENFLAGS_METHODDEF
1092 : #endif /* !defined(SYS_GETDLOPENFLAGS_METHODDEF) */
1093 :
1094 : #ifndef SYS_MDEBUG_METHODDEF
1095 : #define SYS_MDEBUG_METHODDEF
1096 : #endif /* !defined(SYS_MDEBUG_METHODDEF) */
1097 :
1098 : #ifndef SYS_GETTOTALREFCOUNT_METHODDEF
1099 : #define SYS_GETTOTALREFCOUNT_METHODDEF
1100 : #endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */
1101 :
1102 : #ifndef SYS__STATS_ON_METHODDEF
1103 : #define SYS__STATS_ON_METHODDEF
1104 : #endif /* !defined(SYS__STATS_ON_METHODDEF) */
1105 :
1106 : #ifndef SYS__STATS_OFF_METHODDEF
1107 : #define SYS__STATS_OFF_METHODDEF
1108 : #endif /* !defined(SYS__STATS_OFF_METHODDEF) */
1109 :
1110 : #ifndef SYS__STATS_CLEAR_METHODDEF
1111 : #define SYS__STATS_CLEAR_METHODDEF
1112 : #endif /* !defined(SYS__STATS_CLEAR_METHODDEF) */
1113 :
1114 : #ifndef SYS__STATS_DUMP_METHODDEF
1115 : #define SYS__STATS_DUMP_METHODDEF
1116 : #endif /* !defined(SYS__STATS_DUMP_METHODDEF) */
1117 :
1118 : #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
1119 : #define SYS_GETANDROIDAPILEVEL_METHODDEF
1120 : #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
1121 : /*[clinic end generated code: output=41122dae1bb7158c input=a9049054013a1b77]*/
|