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