Coverage Report

Created: 2025-10-12 06:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Python/clinic/sysmodule.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6
#  include "pycore_gc.h"          // PyGC_Head
7
#  include "pycore_runtime.h"     // _Py_ID()
8
#endif
9
#include "pycore_modsupport.h"    // _PyArg_UnpackKeywords()
10
11
PyDoc_STRVAR(sys_addaudithook__doc__,
12
"addaudithook($module, /, hook)\n"
13
"--\n"
14
"\n"
15
"Adds a new audit hook callback.");
16
17
#define SYS_ADDAUDITHOOK_METHODDEF    \
18
    {"addaudithook", _PyCFunction_CAST(sys_addaudithook), METH_FASTCALL|METH_KEYWORDS, sys_addaudithook__doc__},
19
20
static PyObject *
21
sys_addaudithook_impl(PyObject *module, PyObject *hook);
22
23
static PyObject *
24
sys_addaudithook(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
25
0
{
26
0
    PyObject *return_value = NULL;
27
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
28
29
0
    #define NUM_KEYWORDS 1
30
0
    static struct {
31
0
        PyGC_Head _this_is_not_used;
32
0
        PyObject_VAR_HEAD
33
0
        Py_hash_t ob_hash;
34
0
        PyObject *ob_item[NUM_KEYWORDS];
35
0
    } _kwtuple = {
36
0
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
37
0
        .ob_hash = -1,
38
0
        .ob_item = { &_Py_ID(hook), },
39
0
    };
40
0
    #undef NUM_KEYWORDS
41
0
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
42
43
    #else  // !Py_BUILD_CORE
44
    #  define KWTUPLE NULL
45
    #endif  // !Py_BUILD_CORE
46
47
0
    static const char * const _keywords[] = {"hook", NULL};
48
0
    static _PyArg_Parser _parser = {
49
0
        .keywords = _keywords,
50
0
        .fname = "addaudithook",
51
0
        .kwtuple = KWTUPLE,
52
0
    };
53
0
    #undef KWTUPLE
54
0
    PyObject *argsbuf[1];
55
0
    PyObject *hook;
56
57
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
58
0
            /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
59
0
    if (!args) {
60
0
        goto exit;
61
0
    }
62
0
    hook = args[0];
63
0
    return_value = sys_addaudithook_impl(module, hook);
64
65
0
exit:
66
0
    return return_value;
67
0
}
68
69
PyDoc_STRVAR(sys_audit__doc__,
70
"audit($module, event, /, *args)\n"
71
"--\n"
72
"\n"
73
"Passes the event to any audit hooks that are attached.");
74
75
#define SYS_AUDIT_METHODDEF    \
76
    {"audit", _PyCFunction_CAST(sys_audit), METH_FASTCALL, sys_audit__doc__},
77
78
static PyObject *
79
sys_audit_impl(PyObject *module, const char *event, PyObject *args);
80
81
static PyObject *
82
sys_audit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
83
3.07k
{
84
3.07k
    PyObject *return_value = NULL;
85
3.07k
    const char *event;
86
3.07k
    PyObject *__clinic_args = NULL;
87
88
3.07k
    if (!_PyArg_CheckPositional("audit", nargs, 1, PY_SSIZE_T_MAX)) {
89
0
        goto exit;
90
0
    }
91
3.07k
    if (!PyUnicode_Check(args[0])) {
92
0
        _PyArg_BadArgument("audit", "argument 1", "str", args[0]);
93
0
        goto exit;
94
0
    }
95
3.07k
    Py_ssize_t event_length;
96
3.07k
    event = PyUnicode_AsUTF8AndSize(args[0], &event_length);
97
3.07k
    if (event == NULL) {
98
0
        goto exit;
99
0
    }
100
3.07k
    if (strlen(event) != (size_t)event_length) {
101
0
        PyErr_SetString(PyExc_ValueError, "embedded null character");
102
0
        goto exit;
103
0
    }
104
3.07k
    __clinic_args = PyTuple_FromArray(args + 1, nargs - 1);
105
3.07k
    if (__clinic_args == NULL) {
106
0
        goto exit;
107
0
    }
108
3.07k
    return_value = sys_audit_impl(module, event, __clinic_args);
109
110
3.07k
exit:
111
    /* Cleanup for args */
112
3.07k
    Py_XDECREF(__clinic_args);
113
114
3.07k
    return return_value;
115
3.07k
}
116
117
PyDoc_STRVAR(sys_displayhook__doc__,
118
"displayhook($module, object, /)\n"
119
"--\n"
120
"\n"
121
"Print an object to sys.stdout and also save it in builtins._");
122
123
#define SYS_DISPLAYHOOK_METHODDEF    \
124
    {"displayhook", (PyCFunction)sys_displayhook, METH_O, sys_displayhook__doc__},
125
126
PyDoc_STRVAR(sys_excepthook__doc__,
127
"excepthook($module, exctype, value, traceback, /)\n"
128
"--\n"
129
"\n"
130
"Handle an exception by displaying it with a traceback on sys.stderr.");
131
132
#define SYS_EXCEPTHOOK_METHODDEF    \
133
    {"excepthook", _PyCFunction_CAST(sys_excepthook), METH_FASTCALL, sys_excepthook__doc__},
134
135
static PyObject *
136
sys_excepthook_impl(PyObject *module, PyObject *exctype, PyObject *value,
137
                    PyObject *traceback);
138
139
static PyObject *
140
sys_excepthook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
141
0
{
142
0
    PyObject *return_value = NULL;
143
0
    PyObject *exctype;
144
0
    PyObject *value;
145
0
    PyObject *traceback;
146
147
0
    if (!_PyArg_CheckPositional("excepthook", nargs, 3, 3)) {
148
0
        goto exit;
149
0
    }
150
0
    exctype = args[0];
151
0
    value = args[1];
152
0
    traceback = args[2];
153
0
    return_value = sys_excepthook_impl(module, exctype, value, traceback);
154
155
0
exit:
156
0
    return return_value;
157
0
}
158
159
PyDoc_STRVAR(sys_exception__doc__,
160
"exception($module, /)\n"
161
"--\n"
162
"\n"
163
"Return the current exception.\n"
164
"\n"
165
"Return the most recent exception caught by an except clause\n"
166
"in the current stack frame or in an older stack frame, or None\n"
167
"if no such exception exists.");
168
169
#define SYS_EXCEPTION_METHODDEF    \
170
    {"exception", (PyCFunction)sys_exception, METH_NOARGS, sys_exception__doc__},
171
172
static PyObject *
173
sys_exception_impl(PyObject *module);
174
175
static PyObject *
176
sys_exception(PyObject *module, PyObject *Py_UNUSED(ignored))
177
0
{
178
0
    return sys_exception_impl(module);
179
0
}
180
181
PyDoc_STRVAR(sys_exc_info__doc__,
182
"exc_info($module, /)\n"
183
"--\n"
184
"\n"
185
"Return current exception information: (type, value, traceback).\n"
186
"\n"
187
"Return information about the most recent exception caught by an except\n"
188
"clause in the current stack frame or in an older stack frame.");
189
190
#define SYS_EXC_INFO_METHODDEF    \
191
    {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, sys_exc_info__doc__},
192
193
static PyObject *
194
sys_exc_info_impl(PyObject *module);
195
196
static PyObject *
197
sys_exc_info(PyObject *module, PyObject *Py_UNUSED(ignored))
198
0
{
199
0
    return sys_exc_info_impl(module);
200
0
}
201
202
PyDoc_STRVAR(sys_unraisablehook__doc__,
203
"unraisablehook($module, unraisable, /)\n"
204
"--\n"
205
"\n"
206
"Handle an unraisable exception.\n"
207
"\n"
208
"The unraisable argument has the following attributes:\n"
209
"\n"
210
"* exc_type: Exception type.\n"
211
"* exc_value: Exception value, can be None.\n"
212
"* exc_traceback: Exception traceback, can be None.\n"
213
"* err_msg: Error message, can be None.\n"
214
"* object: Object causing the exception, can be None.");
215
216
#define SYS_UNRAISABLEHOOK_METHODDEF    \
217
    {"unraisablehook", (PyCFunction)sys_unraisablehook, METH_O, sys_unraisablehook__doc__},
218
219
PyDoc_STRVAR(sys_exit__doc__,
220
"exit($module, status=None, /)\n"
221
"--\n"
222
"\n"
223
"Exit the interpreter by raising SystemExit(status).\n"
224
"\n"
225
"If the status is omitted or None, it defaults to zero (i.e., success).\n"
226
"If the status is an integer, it will be used as the system exit status.\n"
227
"If it is another kind of object, it will be printed and the system\n"
228
"exit status will be one (i.e., failure).");
229
230
#define SYS_EXIT_METHODDEF    \
231
    {"exit", _PyCFunction_CAST(sys_exit), METH_FASTCALL, sys_exit__doc__},
232
233
static PyObject *
234
sys_exit_impl(PyObject *module, PyObject *status);
235
236
static PyObject *
237
sys_exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
238
0
{
239
0
    PyObject *return_value = NULL;
240
0
    PyObject *status = Py_None;
241
242
0
    if (!_PyArg_CheckPositional("exit", nargs, 0, 1)) {
243
0
        goto exit;
244
0
    }
245
0
    if (nargs < 1) {
246
0
        goto skip_optional;
247
0
    }
248
0
    status = args[0];
249
0
skip_optional:
250
0
    return_value = sys_exit_impl(module, status);
251
252
0
exit:
253
0
    return return_value;
254
0
}
255
256
PyDoc_STRVAR(sys_getdefaultencoding__doc__,
257
"getdefaultencoding($module, /)\n"
258
"--\n"
259
"\n"
260
"Return the current default encoding used by the Unicode implementation.");
261
262
#define SYS_GETDEFAULTENCODING_METHODDEF    \
263
    {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS, sys_getdefaultencoding__doc__},
264
265
static PyObject *
266
sys_getdefaultencoding_impl(PyObject *module);
267
268
static PyObject *
269
sys_getdefaultencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
270
0
{
271
0
    return sys_getdefaultencoding_impl(module);
272
0
}
273
274
PyDoc_STRVAR(sys_getfilesystemencoding__doc__,
275
"getfilesystemencoding($module, /)\n"
276
"--\n"
277
"\n"
278
"Return the encoding used to convert Unicode filenames to OS filenames.");
279
280
#define SYS_GETFILESYSTEMENCODING_METHODDEF    \
281
    {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, METH_NOARGS, sys_getfilesystemencoding__doc__},
282
283
static PyObject *
284
sys_getfilesystemencoding_impl(PyObject *module);
285
286
static PyObject *
287
sys_getfilesystemencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
288
32
{
289
32
    return sys_getfilesystemencoding_impl(module);
290
32
}
291
292
PyDoc_STRVAR(sys_getfilesystemencodeerrors__doc__,
293
"getfilesystemencodeerrors($module, /)\n"
294
"--\n"
295
"\n"
296
"Return the error mode used Unicode to OS filename conversion.");
297
298
#define SYS_GETFILESYSTEMENCODEERRORS_METHODDEF    \
299
    {"getfilesystemencodeerrors", (PyCFunction)sys_getfilesystemencodeerrors, METH_NOARGS, sys_getfilesystemencodeerrors__doc__},
300
301
static PyObject *
302
sys_getfilesystemencodeerrors_impl(PyObject *module);
303
304
static PyObject *
305
sys_getfilesystemencodeerrors(PyObject *module, PyObject *Py_UNUSED(ignored))
306
16
{
307
16
    return sys_getfilesystemencodeerrors_impl(module);
308
16
}
309
310
PyDoc_STRVAR(sys_intern__doc__,
311
"intern($module, string, /)\n"
312
"--\n"
313
"\n"
314
"``Intern\'\' the given string.\n"
315
"\n"
316
"This enters the string in the (global) table of interned strings whose\n"
317
"purpose is to speed up dictionary lookups. Return the string itself or\n"
318
"the previously interned string object with the same value.");
319
320
#define SYS_INTERN_METHODDEF    \
321
    {"intern", (PyCFunction)sys_intern, METH_O, sys_intern__doc__},
322
323
static PyObject *
324
sys_intern_impl(PyObject *module, PyObject *s);
325
326
static PyObject *
327
sys_intern(PyObject *module, PyObject *arg)
328
666
{
329
666
    PyObject *return_value = NULL;
330
666
    PyObject *s;
331
332
666
    if (!PyUnicode_Check(arg)) {
333
0
        _PyArg_BadArgument("intern", "argument", "str", arg);
334
0
        goto exit;
335
0
    }
336
666
    s = arg;
337
666
    return_value = sys_intern_impl(module, s);
338
339
666
exit:
340
666
    return return_value;
341
666
}
342
343
PyDoc_STRVAR(sys__is_interned__doc__,
344
"_is_interned($module, string, /)\n"
345
"--\n"
346
"\n"
347
"Return True if the given string is \"interned\".");
348
349
#define SYS__IS_INTERNED_METHODDEF    \
350
    {"_is_interned", (PyCFunction)sys__is_interned, METH_O, sys__is_interned__doc__},
351
352
static int
353
sys__is_interned_impl(PyObject *module, PyObject *string);
354
355
static PyObject *
356
sys__is_interned(PyObject *module, PyObject *arg)
357
0
{
358
0
    PyObject *return_value = NULL;
359
0
    PyObject *string;
360
0
    int _return_value;
361
362
0
    if (!PyUnicode_Check(arg)) {
363
0
        _PyArg_BadArgument("_is_interned", "argument", "str", arg);
364
0
        goto exit;
365
0
    }
366
0
    string = arg;
367
0
    _return_value = sys__is_interned_impl(module, string);
368
0
    if ((_return_value == -1) && PyErr_Occurred()) {
369
0
        goto exit;
370
0
    }
371
0
    return_value = PyBool_FromLong((long)_return_value);
372
373
0
exit:
374
0
    return return_value;
375
0
}
376
377
PyDoc_STRVAR(sys__is_immortal__doc__,
378
"_is_immortal($module, op, /)\n"
379
"--\n"
380
"\n"
381
"Return True if the given object is \"immortal\" per PEP 683.\n"
382
"\n"
383
"This function should be used for specialized purposes only.");
384
385
#define SYS__IS_IMMORTAL_METHODDEF    \
386
    {"_is_immortal", (PyCFunction)sys__is_immortal, METH_O, sys__is_immortal__doc__},
387
388
static int
389
sys__is_immortal_impl(PyObject *module, PyObject *op);
390
391
static PyObject *
392
sys__is_immortal(PyObject *module, PyObject *op)
393
0
{
394
0
    PyObject *return_value = NULL;
395
0
    int _return_value;
396
397
0
    _return_value = sys__is_immortal_impl(module, op);
398
0
    if ((_return_value == -1) && PyErr_Occurred()) {
399
0
        goto exit;
400
0
    }
401
0
    return_value = PyBool_FromLong((long)_return_value);
402
403
0
exit:
404
0
    return return_value;
405
0
}
406
407
PyDoc_STRVAR(sys_settrace__doc__,
408
"settrace($module, function, /)\n"
409
"--\n"
410
"\n"
411
"Set the global debug tracing function.\n"
412
"\n"
413
"It will be called on each function call.  See the debugger chapter\n"
414
"in the library manual.");
415
416
#define SYS_SETTRACE_METHODDEF    \
417
    {"settrace", (PyCFunction)sys_settrace, METH_O, sys_settrace__doc__},
418
419
PyDoc_STRVAR(sys__settraceallthreads__doc__,
420
"_settraceallthreads($module, function, /)\n"
421
"--\n"
422
"\n"
423
"Set the global debug tracing function in all running threads belonging to the current interpreter.\n"
424
"\n"
425
"It will be called on each function call. See the debugger chapter\n"
426
"in the library manual.");
427
428
#define SYS__SETTRACEALLTHREADS_METHODDEF    \
429
    {"_settraceallthreads", (PyCFunction)sys__settraceallthreads, METH_O, sys__settraceallthreads__doc__},
430
431
PyDoc_STRVAR(sys_gettrace__doc__,
432
"gettrace($module, /)\n"
433
"--\n"
434
"\n"
435
"Return the global debug tracing function set with sys.settrace.\n"
436
"\n"
437
"See the debugger chapter in the library manual.");
438
439
#define SYS_GETTRACE_METHODDEF    \
440
    {"gettrace", (PyCFunction)sys_gettrace, METH_NOARGS, sys_gettrace__doc__},
441
442
static PyObject *
443
sys_gettrace_impl(PyObject *module);
444
445
static PyObject *
446
sys_gettrace(PyObject *module, PyObject *Py_UNUSED(ignored))
447
0
{
448
0
    return sys_gettrace_impl(module);
449
0
}
450
451
PyDoc_STRVAR(sys_setprofile__doc__,
452
"setprofile($module, function, /)\n"
453
"--\n"
454
"\n"
455
"Set the profiling function.\n"
456
"\n"
457
"It will be called on each function call and return.  See the profiler\n"
458
"chapter in the library manual.");
459
460
#define SYS_SETPROFILE_METHODDEF    \
461
    {"setprofile", (PyCFunction)sys_setprofile, METH_O, sys_setprofile__doc__},
462
463
PyDoc_STRVAR(sys__setprofileallthreads__doc__,
464
"_setprofileallthreads($module, function, /)\n"
465
"--\n"
466
"\n"
467
"Set the profiling function in all running threads belonging to the current interpreter.\n"
468
"\n"
469
"It will be called on each function call and return.  See the profiler\n"
470
"chapter in the library manual.");
471
472
#define SYS__SETPROFILEALLTHREADS_METHODDEF    \
473
    {"_setprofileallthreads", (PyCFunction)sys__setprofileallthreads, METH_O, sys__setprofileallthreads__doc__},
474
475
PyDoc_STRVAR(sys_getprofile__doc__,
476
"getprofile($module, /)\n"
477
"--\n"
478
"\n"
479
"Return the profiling function set with sys.setprofile.\n"
480
"\n"
481
"See the profiler chapter in the library manual.");
482
483
#define SYS_GETPROFILE_METHODDEF    \
484
    {"getprofile", (PyCFunction)sys_getprofile, METH_NOARGS, sys_getprofile__doc__},
485
486
static PyObject *
487
sys_getprofile_impl(PyObject *module);
488
489
static PyObject *
490
sys_getprofile(PyObject *module, PyObject *Py_UNUSED(ignored))
491
0
{
492
0
    return sys_getprofile_impl(module);
493
0
}
494
495
PyDoc_STRVAR(sys_setswitchinterval__doc__,
496
"setswitchinterval($module, interval, /)\n"
497
"--\n"
498
"\n"
499
"Set the ideal thread switching delay inside the Python interpreter.\n"
500
"\n"
501
"The actual frequency of switching threads can be lower if the\n"
502
"interpreter executes long sequences of uninterruptible code\n"
503
"(this is implementation-specific and workload-dependent).\n"
504
"\n"
505
"The parameter must represent the desired switching delay in seconds\n"
506
"A typical value is 0.005 (5 milliseconds).");
507
508
#define SYS_SETSWITCHINTERVAL_METHODDEF    \
509
    {"setswitchinterval", (PyCFunction)sys_setswitchinterval, METH_O, sys_setswitchinterval__doc__},
510
511
static PyObject *
512
sys_setswitchinterval_impl(PyObject *module, double interval);
513
514
static PyObject *
515
sys_setswitchinterval(PyObject *module, PyObject *arg)
516
0
{
517
0
    PyObject *return_value = NULL;
518
0
    double interval;
519
520
0
    if (PyFloat_CheckExact(arg)) {
521
0
        interval = PyFloat_AS_DOUBLE(arg);
522
0
    }
523
0
    else
524
0
    {
525
0
        interval = PyFloat_AsDouble(arg);
526
0
        if (interval == -1.0 && PyErr_Occurred()) {
527
0
            goto exit;
528
0
        }
529
0
    }
530
0
    return_value = sys_setswitchinterval_impl(module, interval);
531
532
0
exit:
533
0
    return return_value;
534
0
}
535
536
PyDoc_STRVAR(sys_getswitchinterval__doc__,
537
"getswitchinterval($module, /)\n"
538
"--\n"
539
"\n"
540
"Return the current thread switch interval; see sys.setswitchinterval().");
541
542
#define SYS_GETSWITCHINTERVAL_METHODDEF    \
543
    {"getswitchinterval", (PyCFunction)sys_getswitchinterval, METH_NOARGS, sys_getswitchinterval__doc__},
544
545
static double
546
sys_getswitchinterval_impl(PyObject *module);
547
548
static PyObject *
549
sys_getswitchinterval(PyObject *module, PyObject *Py_UNUSED(ignored))
550
0
{
551
0
    PyObject *return_value = NULL;
552
0
    double _return_value;
553
554
0
    _return_value = sys_getswitchinterval_impl(module);
555
0
    if ((_return_value == -1.0) && PyErr_Occurred()) {
556
0
        goto exit;
557
0
    }
558
0
    return_value = PyFloat_FromDouble(_return_value);
559
560
0
exit:
561
0
    return return_value;
562
0
}
563
564
PyDoc_STRVAR(sys_setrecursionlimit__doc__,
565
"setrecursionlimit($module, limit, /)\n"
566
"--\n"
567
"\n"
568
"Set the maximum depth of the Python interpreter stack to n.\n"
569
"\n"
570
"This limit prevents infinite recursion from causing an overflow of the C\n"
571
"stack and crashing Python.  The highest possible limit is platform-\n"
572
"dependent.");
573
574
#define SYS_SETRECURSIONLIMIT_METHODDEF    \
575
    {"setrecursionlimit", (PyCFunction)sys_setrecursionlimit, METH_O, sys_setrecursionlimit__doc__},
576
577
static PyObject *
578
sys_setrecursionlimit_impl(PyObject *module, int new_limit);
579
580
static PyObject *
581
sys_setrecursionlimit(PyObject *module, PyObject *arg)
582
0
{
583
0
    PyObject *return_value = NULL;
584
0
    int new_limit;
585
586
0
    new_limit = PyLong_AsInt(arg);
587
0
    if (new_limit == -1 && PyErr_Occurred()) {
588
0
        goto exit;
589
0
    }
590
0
    return_value = sys_setrecursionlimit_impl(module, new_limit);
591
592
0
exit:
593
0
    return return_value;
594
0
}
595
596
PyDoc_STRVAR(sys_set_coroutine_origin_tracking_depth__doc__,
597
"set_coroutine_origin_tracking_depth($module, /, depth)\n"
598
"--\n"
599
"\n"
600
"Enable or disable origin tracking for coroutine objects in this thread.\n"
601
"\n"
602
"Coroutine objects will track \'depth\' frames of traceback information\n"
603
"about where they came from, available in their cr_origin attribute.\n"
604
"\n"
605
"Set a depth of 0 to disable.");
606
607
#define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF    \
608
    {"set_coroutine_origin_tracking_depth", _PyCFunction_CAST(sys_set_coroutine_origin_tracking_depth), METH_FASTCALL|METH_KEYWORDS, sys_set_coroutine_origin_tracking_depth__doc__},
609
610
static PyObject *
611
sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth);
612
613
static PyObject *
614
sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
615
0
{
616
0
    PyObject *return_value = NULL;
617
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
618
619
0
    #define NUM_KEYWORDS 1
620
0
    static struct {
621
0
        PyGC_Head _this_is_not_used;
622
0
        PyObject_VAR_HEAD
623
0
        Py_hash_t ob_hash;
624
0
        PyObject *ob_item[NUM_KEYWORDS];
625
0
    } _kwtuple = {
626
0
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
627
0
        .ob_hash = -1,
628
0
        .ob_item = { &_Py_ID(depth), },
629
0
    };
630
0
    #undef NUM_KEYWORDS
631
0
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
632
633
    #else  // !Py_BUILD_CORE
634
    #  define KWTUPLE NULL
635
    #endif  // !Py_BUILD_CORE
636
637
0
    static const char * const _keywords[] = {"depth", NULL};
638
0
    static _PyArg_Parser _parser = {
639
0
        .keywords = _keywords,
640
0
        .fname = "set_coroutine_origin_tracking_depth",
641
0
        .kwtuple = KWTUPLE,
642
0
    };
643
0
    #undef KWTUPLE
644
0
    PyObject *argsbuf[1];
645
0
    int depth;
646
647
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
648
0
            /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
649
0
    if (!args) {
650
0
        goto exit;
651
0
    }
652
0
    depth = PyLong_AsInt(args[0]);
653
0
    if (depth == -1 && PyErr_Occurred()) {
654
0
        goto exit;
655
0
    }
656
0
    return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth);
657
658
0
exit:
659
0
    return return_value;
660
0
}
661
662
PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__,
663
"get_coroutine_origin_tracking_depth($module, /)\n"
664
"--\n"
665
"\n"
666
"Check status of origin tracking for coroutine objects in this thread.");
667
668
#define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF    \
669
    {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__},
670
671
static int
672
sys_get_coroutine_origin_tracking_depth_impl(PyObject *module);
673
674
static PyObject *
675
sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored))
676
0
{
677
0
    PyObject *return_value = NULL;
678
0
    int _return_value;
679
680
0
    _return_value = sys_get_coroutine_origin_tracking_depth_impl(module);
681
0
    if ((_return_value == -1) && PyErr_Occurred()) {
682
0
        goto exit;
683
0
    }
684
0
    return_value = PyLong_FromLong((long)_return_value);
685
686
0
exit:
687
0
    return return_value;
688
0
}
689
690
PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__,
691
"get_asyncgen_hooks($module, /)\n"
692
"--\n"
693
"\n"
694
"Return the installed asynchronous generators hooks.\n"
695
"\n"
696
"This returns a namedtuple of the form (firstiter, finalizer).");
697
698
#define SYS_GET_ASYNCGEN_HOOKS_METHODDEF    \
699
    {"get_asyncgen_hooks", (PyCFunction)sys_get_asyncgen_hooks, METH_NOARGS, sys_get_asyncgen_hooks__doc__},
700
701
static PyObject *
702
sys_get_asyncgen_hooks_impl(PyObject *module);
703
704
static PyObject *
705
sys_get_asyncgen_hooks(PyObject *module, PyObject *Py_UNUSED(ignored))
706
0
{
707
0
    return sys_get_asyncgen_hooks_impl(module);
708
0
}
709
710
PyDoc_STRVAR(sys_getrecursionlimit__doc__,
711
"getrecursionlimit($module, /)\n"
712
"--\n"
713
"\n"
714
"Return the current value of the recursion limit.\n"
715
"\n"
716
"The recursion limit is the maximum depth of the Python interpreter\n"
717
"stack.  This limit prevents infinite recursion from causing an overflow\n"
718
"of the C stack and crashing Python.");
719
720
#define SYS_GETRECURSIONLIMIT_METHODDEF    \
721
    {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, sys_getrecursionlimit__doc__},
722
723
static PyObject *
724
sys_getrecursionlimit_impl(PyObject *module);
725
726
static PyObject *
727
sys_getrecursionlimit(PyObject *module, PyObject *Py_UNUSED(ignored))
728
40
{
729
40
    return sys_getrecursionlimit_impl(module);
730
40
}
731
732
#if defined(MS_WINDOWS)
733
734
PyDoc_STRVAR(sys_getwindowsversion__doc__,
735
"getwindowsversion($module, /)\n"
736
"--\n"
737
"\n"
738
"Return info about the running version of Windows as a named tuple.\n"
739
"\n"
740
"The members are named: major, minor, build, platform, service_pack,\n"
741
"service_pack_major, service_pack_minor, suite_mask, product_type and\n"
742
"platform_version. For backward compatibility, only the first 5 items\n"
743
"are available by indexing. All elements are numbers, except\n"
744
"service_pack and platform_type which are strings, and platform_version\n"
745
"which is a 3-tuple. Platform is always 2. Product_type may be 1 for a\n"
746
"workstation, 2 for a domain controller, 3 for a server.\n"
747
"Platform_version is a 3-tuple containing a version number that is\n"
748
"intended for identifying the OS rather than feature detection.");
749
750
#define SYS_GETWINDOWSVERSION_METHODDEF    \
751
    {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, sys_getwindowsversion__doc__},
752
753
static PyObject *
754
sys_getwindowsversion_impl(PyObject *module);
755
756
static PyObject *
757
sys_getwindowsversion(PyObject *module, PyObject *Py_UNUSED(ignored))
758
{
759
    return sys_getwindowsversion_impl(module);
760
}
761
762
#endif /* defined(MS_WINDOWS) */
763
764
#if defined(MS_WINDOWS)
765
766
PyDoc_STRVAR(sys__enablelegacywindowsfsencoding__doc__,
767
"_enablelegacywindowsfsencoding($module, /)\n"
768
"--\n"
769
"\n"
770
"Changes the default filesystem encoding to mbcs:replace.\n"
771
"\n"
772
"This is done for consistency with earlier versions of Python. See PEP\n"
773
"529 for more information.\n"
774
"\n"
775
"This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING\n"
776
"environment variable before launching Python.");
777
778
#define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF    \
779
    {"_enablelegacywindowsfsencoding", (PyCFunction)sys__enablelegacywindowsfsencoding, METH_NOARGS, sys__enablelegacywindowsfsencoding__doc__},
780
781
static PyObject *
782
sys__enablelegacywindowsfsencoding_impl(PyObject *module);
783
784
static PyObject *
785
sys__enablelegacywindowsfsencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
786
{
787
    return sys__enablelegacywindowsfsencoding_impl(module);
788
}
789
790
#endif /* defined(MS_WINDOWS) */
791
792
#if defined(HAVE_DLOPEN)
793
794
PyDoc_STRVAR(sys_setdlopenflags__doc__,
795
"setdlopenflags($module, flags, /)\n"
796
"--\n"
797
"\n"
798
"Set the flags used by the interpreter for dlopen calls.\n"
799
"\n"
800
"This is used, for example, when the interpreter loads extension\n"
801
"modules. Among other things, this will enable a lazy resolving of\n"
802
"symbols when importing a module, if called as sys.setdlopenflags(0).\n"
803
"To share symbols across extension modules, call as\n"
804
"sys.setdlopenflags(os.RTLD_GLOBAL).  Symbolic names for the flag\n"
805
"modules can be found in the os module (RTLD_xxx constants, e.g.\n"
806
"os.RTLD_LAZY).");
807
808
#define SYS_SETDLOPENFLAGS_METHODDEF    \
809
    {"setdlopenflags", (PyCFunction)sys_setdlopenflags, METH_O, sys_setdlopenflags__doc__},
810
811
static PyObject *
812
sys_setdlopenflags_impl(PyObject *module, int new_val);
813
814
static PyObject *
815
sys_setdlopenflags(PyObject *module, PyObject *arg)
816
0
{
817
0
    PyObject *return_value = NULL;
818
0
    int new_val;
819
820
0
    new_val = PyLong_AsInt(arg);
821
0
    if (new_val == -1 && PyErr_Occurred()) {
822
0
        goto exit;
823
0
    }
824
0
    return_value = sys_setdlopenflags_impl(module, new_val);
825
826
0
exit:
827
0
    return return_value;
828
0
}
829
830
#endif /* defined(HAVE_DLOPEN) */
831
832
#if defined(HAVE_DLOPEN)
833
834
PyDoc_STRVAR(sys_getdlopenflags__doc__,
835
"getdlopenflags($module, /)\n"
836
"--\n"
837
"\n"
838
"Return the current value of the flags that are used for dlopen calls.\n"
839
"\n"
840
"The flag constants are defined in the os module.");
841
842
#define SYS_GETDLOPENFLAGS_METHODDEF    \
843
    {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, sys_getdlopenflags__doc__},
844
845
static PyObject *
846
sys_getdlopenflags_impl(PyObject *module);
847
848
static PyObject *
849
sys_getdlopenflags(PyObject *module, PyObject *Py_UNUSED(ignored))
850
0
{
851
0
    return sys_getdlopenflags_impl(module);
852
0
}
853
854
#endif /* defined(HAVE_DLOPEN) */
855
856
#if defined(USE_MALLOPT)
857
858
PyDoc_STRVAR(sys_mdebug__doc__,
859
"mdebug($module, flag, /)\n"
860
"--\n"
861
"\n");
862
863
#define SYS_MDEBUG_METHODDEF    \
864
    {"mdebug", (PyCFunction)sys_mdebug, METH_O, sys_mdebug__doc__},
865
866
static PyObject *
867
sys_mdebug_impl(PyObject *module, int flag);
868
869
static PyObject *
870
sys_mdebug(PyObject *module, PyObject *arg)
871
{
872
    PyObject *return_value = NULL;
873
    int flag;
874
875
    flag = PyLong_AsInt(arg);
876
    if (flag == -1 && PyErr_Occurred()) {
877
        goto exit;
878
    }
879
    return_value = sys_mdebug_impl(module, flag);
880
881
exit:
882
    return return_value;
883
}
884
885
#endif /* defined(USE_MALLOPT) */
886
887
PyDoc_STRVAR(sys_get_int_max_str_digits__doc__,
888
"get_int_max_str_digits($module, /)\n"
889
"--\n"
890
"\n"
891
"Return the maximum string digits limit for non-binary int<->str conversions.");
892
893
#define SYS_GET_INT_MAX_STR_DIGITS_METHODDEF    \
894
    {"get_int_max_str_digits", (PyCFunction)sys_get_int_max_str_digits, METH_NOARGS, sys_get_int_max_str_digits__doc__},
895
896
static PyObject *
897
sys_get_int_max_str_digits_impl(PyObject *module);
898
899
static PyObject *
900
sys_get_int_max_str_digits(PyObject *module, PyObject *Py_UNUSED(ignored))
901
0
{
902
0
    return sys_get_int_max_str_digits_impl(module);
903
0
}
904
905
PyDoc_STRVAR(sys_set_int_max_str_digits__doc__,
906
"set_int_max_str_digits($module, /, maxdigits)\n"
907
"--\n"
908
"\n"
909
"Set the maximum string digits limit for non-binary int<->str conversions.");
910
911
#define SYS_SET_INT_MAX_STR_DIGITS_METHODDEF    \
912
    {"set_int_max_str_digits", _PyCFunction_CAST(sys_set_int_max_str_digits), METH_FASTCALL|METH_KEYWORDS, sys_set_int_max_str_digits__doc__},
913
914
static PyObject *
915
sys_set_int_max_str_digits_impl(PyObject *module, int maxdigits);
916
917
static PyObject *
918
sys_set_int_max_str_digits(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
919
0
{
920
0
    PyObject *return_value = NULL;
921
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
922
923
0
    #define NUM_KEYWORDS 1
924
0
    static struct {
925
0
        PyGC_Head _this_is_not_used;
926
0
        PyObject_VAR_HEAD
927
0
        Py_hash_t ob_hash;
928
0
        PyObject *ob_item[NUM_KEYWORDS];
929
0
    } _kwtuple = {
930
0
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
931
0
        .ob_hash = -1,
932
0
        .ob_item = { &_Py_ID(maxdigits), },
933
0
    };
934
0
    #undef NUM_KEYWORDS
935
0
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
936
937
    #else  // !Py_BUILD_CORE
938
    #  define KWTUPLE NULL
939
    #endif  // !Py_BUILD_CORE
940
941
0
    static const char * const _keywords[] = {"maxdigits", NULL};
942
0
    static _PyArg_Parser _parser = {
943
0
        .keywords = _keywords,
944
0
        .fname = "set_int_max_str_digits",
945
0
        .kwtuple = KWTUPLE,
946
0
    };
947
0
    #undef KWTUPLE
948
0
    PyObject *argsbuf[1];
949
0
    int maxdigits;
950
951
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
952
0
            /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
953
0
    if (!args) {
954
0
        goto exit;
955
0
    }
956
0
    maxdigits = PyLong_AsInt(args[0]);
957
0
    if (maxdigits == -1 && PyErr_Occurred()) {
958
0
        goto exit;
959
0
    }
960
0
    return_value = sys_set_int_max_str_digits_impl(module, maxdigits);
961
962
0
exit:
963
0
    return return_value;
964
0
}
965
966
PyDoc_STRVAR(sys_getrefcount__doc__,
967
"getrefcount($module, object, /)\n"
968
"--\n"
969
"\n"
970
"Return the reference count of object.\n"
971
"\n"
972
"The count returned is generally one higher than you might expect,\n"
973
"because it includes the (temporary) reference as an argument to\n"
974
"getrefcount().");
975
976
#define SYS_GETREFCOUNT_METHODDEF    \
977
    {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, sys_getrefcount__doc__},
978
979
static Py_ssize_t
980
sys_getrefcount_impl(PyObject *module, PyObject *object);
981
982
static PyObject *
983
sys_getrefcount(PyObject *module, PyObject *object)
984
0
{
985
0
    PyObject *return_value = NULL;
986
0
    Py_ssize_t _return_value;
987
988
0
    _return_value = sys_getrefcount_impl(module, object);
989
0
    if ((_return_value == -1) && PyErr_Occurred()) {
990
0
        goto exit;
991
0
    }
992
0
    return_value = PyLong_FromSsize_t(_return_value);
993
994
0
exit:
995
0
    return return_value;
996
0
}
997
998
#if defined(Py_REF_DEBUG)
999
1000
PyDoc_STRVAR(sys_gettotalrefcount__doc__,
1001
"gettotalrefcount($module, /)\n"
1002
"--\n"
1003
"\n");
1004
1005
#define SYS_GETTOTALREFCOUNT_METHODDEF    \
1006
    {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS, sys_gettotalrefcount__doc__},
1007
1008
static Py_ssize_t
1009
sys_gettotalrefcount_impl(PyObject *module);
1010
1011
static PyObject *
1012
sys_gettotalrefcount(PyObject *module, PyObject *Py_UNUSED(ignored))
1013
{
1014
    PyObject *return_value = NULL;
1015
    Py_ssize_t _return_value;
1016
1017
    _return_value = sys_gettotalrefcount_impl(module);
1018
    if ((_return_value == -1) && PyErr_Occurred()) {
1019
        goto exit;
1020
    }
1021
    return_value = PyLong_FromSsize_t(_return_value);
1022
1023
exit:
1024
    return return_value;
1025
}
1026
1027
#endif /* defined(Py_REF_DEBUG) */
1028
1029
PyDoc_STRVAR(sys_getallocatedblocks__doc__,
1030
"getallocatedblocks($module, /)\n"
1031
"--\n"
1032
"\n"
1033
"Return the number of memory blocks currently allocated.");
1034
1035
#define SYS_GETALLOCATEDBLOCKS_METHODDEF    \
1036
    {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS, sys_getallocatedblocks__doc__},
1037
1038
static Py_ssize_t
1039
sys_getallocatedblocks_impl(PyObject *module);
1040
1041
static PyObject *
1042
sys_getallocatedblocks(PyObject *module, PyObject *Py_UNUSED(ignored))
1043
0
{
1044
0
    PyObject *return_value = NULL;
1045
0
    Py_ssize_t _return_value;
1046
1047
0
    _return_value = sys_getallocatedblocks_impl(module);
1048
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1049
0
        goto exit;
1050
0
    }
1051
0
    return_value = PyLong_FromSsize_t(_return_value);
1052
1053
0
exit:
1054
0
    return return_value;
1055
0
}
1056
1057
PyDoc_STRVAR(sys_getunicodeinternedsize__doc__,
1058
"getunicodeinternedsize($module, /, *, _only_immortal=False)\n"
1059
"--\n"
1060
"\n"
1061
"Return the number of elements of the unicode interned dictionary");
1062
1063
#define SYS_GETUNICODEINTERNEDSIZE_METHODDEF    \
1064
    {"getunicodeinternedsize", _PyCFunction_CAST(sys_getunicodeinternedsize), METH_FASTCALL|METH_KEYWORDS, sys_getunicodeinternedsize__doc__},
1065
1066
static Py_ssize_t
1067
sys_getunicodeinternedsize_impl(PyObject *module, int _only_immortal);
1068
1069
static PyObject *
1070
sys_getunicodeinternedsize(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1071
0
{
1072
0
    PyObject *return_value = NULL;
1073
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1074
1075
0
    #define NUM_KEYWORDS 1
1076
0
    static struct {
1077
0
        PyGC_Head _this_is_not_used;
1078
0
        PyObject_VAR_HEAD
1079
0
        Py_hash_t ob_hash;
1080
0
        PyObject *ob_item[NUM_KEYWORDS];
1081
0
    } _kwtuple = {
1082
0
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1083
0
        .ob_hash = -1,
1084
0
        .ob_item = { &_Py_ID(_only_immortal), },
1085
0
    };
1086
0
    #undef NUM_KEYWORDS
1087
0
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1088
1089
    #else  // !Py_BUILD_CORE
1090
    #  define KWTUPLE NULL
1091
    #endif  // !Py_BUILD_CORE
1092
1093
0
    static const char * const _keywords[] = {"_only_immortal", NULL};
1094
0
    static _PyArg_Parser _parser = {
1095
0
        .keywords = _keywords,
1096
0
        .fname = "getunicodeinternedsize",
1097
0
        .kwtuple = KWTUPLE,
1098
0
    };
1099
0
    #undef KWTUPLE
1100
0
    PyObject *argsbuf[1];
1101
0
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
1102
0
    int _only_immortal = 0;
1103
0
    Py_ssize_t _return_value;
1104
1105
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1106
0
            /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1107
0
    if (!args) {
1108
0
        goto exit;
1109
0
    }
1110
0
    if (!noptargs) {
1111
0
        goto skip_optional_kwonly;
1112
0
    }
1113
0
    _only_immortal = PyObject_IsTrue(args[0]);
1114
0
    if (_only_immortal < 0) {
1115
0
        goto exit;
1116
0
    }
1117
0
skip_optional_kwonly:
1118
0
    _return_value = sys_getunicodeinternedsize_impl(module, _only_immortal);
1119
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1120
0
        goto exit;
1121
0
    }
1122
0
    return_value = PyLong_FromSsize_t(_return_value);
1123
1124
0
exit:
1125
0
    return return_value;
1126
0
}
1127
1128
PyDoc_STRVAR(sys__getframe__doc__,
1129
"_getframe($module, depth=0, /)\n"
1130
"--\n"
1131
"\n"
1132
"Return a frame object from the call stack.\n"
1133
"\n"
1134
"If optional integer depth is given, return the frame object that many\n"
1135
"calls below the top of the stack.  If that is deeper than the call\n"
1136
"stack, ValueError is raised.  The default for depth is zero, returning\n"
1137
"the frame at the top of the call stack.\n"
1138
"\n"
1139
"This function should be used for internal and specialized purposes\n"
1140
"only.");
1141
1142
#define SYS__GETFRAME_METHODDEF    \
1143
    {"_getframe", _PyCFunction_CAST(sys__getframe), METH_FASTCALL, sys__getframe__doc__},
1144
1145
static PyObject *
1146
sys__getframe_impl(PyObject *module, int depth);
1147
1148
static PyObject *
1149
sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1150
16
{
1151
16
    PyObject *return_value = NULL;
1152
16
    int depth = 0;
1153
1154
16
    if (!_PyArg_CheckPositional("_getframe", nargs, 0, 1)) {
1155
0
        goto exit;
1156
0
    }
1157
16
    if (nargs < 1) {
1158
16
        goto skip_optional;
1159
16
    }
1160
0
    depth = PyLong_AsInt(args[0]);
1161
0
    if (depth == -1 && PyErr_Occurred()) {
1162
0
        goto exit;
1163
0
    }
1164
16
skip_optional:
1165
16
    return_value = sys__getframe_impl(module, depth);
1166
1167
16
exit:
1168
16
    return return_value;
1169
16
}
1170
1171
PyDoc_STRVAR(sys__current_frames__doc__,
1172
"_current_frames($module, /)\n"
1173
"--\n"
1174
"\n"
1175
"Return a dict mapping each thread\'s thread id to its current stack frame.\n"
1176
"\n"
1177
"This function should be used for specialized purposes only.");
1178
1179
#define SYS__CURRENT_FRAMES_METHODDEF    \
1180
    {"_current_frames", (PyCFunction)sys__current_frames, METH_NOARGS, sys__current_frames__doc__},
1181
1182
static PyObject *
1183
sys__current_frames_impl(PyObject *module);
1184
1185
static PyObject *
1186
sys__current_frames(PyObject *module, PyObject *Py_UNUSED(ignored))
1187
0
{
1188
0
    return sys__current_frames_impl(module);
1189
0
}
1190
1191
PyDoc_STRVAR(sys__current_exceptions__doc__,
1192
"_current_exceptions($module, /)\n"
1193
"--\n"
1194
"\n"
1195
"Return a dict mapping each thread\'s identifier to its current raised exception.\n"
1196
"\n"
1197
"This function should be used for specialized purposes only.");
1198
1199
#define SYS__CURRENT_EXCEPTIONS_METHODDEF    \
1200
    {"_current_exceptions", (PyCFunction)sys__current_exceptions, METH_NOARGS, sys__current_exceptions__doc__},
1201
1202
static PyObject *
1203
sys__current_exceptions_impl(PyObject *module);
1204
1205
static PyObject *
1206
sys__current_exceptions(PyObject *module, PyObject *Py_UNUSED(ignored))
1207
0
{
1208
0
    return sys__current_exceptions_impl(module);
1209
0
}
1210
1211
PyDoc_STRVAR(sys_call_tracing__doc__,
1212
"call_tracing($module, func, args, /)\n"
1213
"--\n"
1214
"\n"
1215
"Call func(*args), while tracing is enabled.\n"
1216
"\n"
1217
"The tracing state is saved, and restored afterwards.  This is intended\n"
1218
"to be called from a debugger from a checkpoint, to recursively debug\n"
1219
"some other code.");
1220
1221
#define SYS_CALL_TRACING_METHODDEF    \
1222
    {"call_tracing", _PyCFunction_CAST(sys_call_tracing), METH_FASTCALL, sys_call_tracing__doc__},
1223
1224
static PyObject *
1225
sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs);
1226
1227
static PyObject *
1228
sys_call_tracing(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1229
0
{
1230
0
    PyObject *return_value = NULL;
1231
0
    PyObject *func;
1232
0
    PyObject *funcargs;
1233
1234
0
    if (!_PyArg_CheckPositional("call_tracing", nargs, 2, 2)) {
1235
0
        goto exit;
1236
0
    }
1237
0
    func = args[0];
1238
0
    if (!PyTuple_Check(args[1])) {
1239
0
        _PyArg_BadArgument("call_tracing", "argument 2", "tuple", args[1]);
1240
0
        goto exit;
1241
0
    }
1242
0
    funcargs = args[1];
1243
0
    return_value = sys_call_tracing_impl(module, func, funcargs);
1244
1245
0
exit:
1246
0
    return return_value;
1247
0
}
1248
1249
PyDoc_STRVAR(sys__debugmallocstats__doc__,
1250
"_debugmallocstats($module, /)\n"
1251
"--\n"
1252
"\n"
1253
"Print summary info to stderr about the state of pymalloc\'s structures.\n"
1254
"\n"
1255
"In Py_DEBUG mode, also perform some expensive internal consistency\n"
1256
"checks.");
1257
1258
#define SYS__DEBUGMALLOCSTATS_METHODDEF    \
1259
    {"_debugmallocstats", (PyCFunction)sys__debugmallocstats, METH_NOARGS, sys__debugmallocstats__doc__},
1260
1261
static PyObject *
1262
sys__debugmallocstats_impl(PyObject *module);
1263
1264
static PyObject *
1265
sys__debugmallocstats(PyObject *module, PyObject *Py_UNUSED(ignored))
1266
0
{
1267
0
    return sys__debugmallocstats_impl(module);
1268
0
}
1269
1270
PyDoc_STRVAR(sys__clear_type_cache__doc__,
1271
"_clear_type_cache($module, /)\n"
1272
"--\n"
1273
"\n"
1274
"Clear the internal type lookup cache.");
1275
1276
#define SYS__CLEAR_TYPE_CACHE_METHODDEF    \
1277
    {"_clear_type_cache", (PyCFunction)sys__clear_type_cache, METH_NOARGS, sys__clear_type_cache__doc__},
1278
1279
static PyObject *
1280
sys__clear_type_cache_impl(PyObject *module);
1281
1282
static PyObject *
1283
sys__clear_type_cache(PyObject *module, PyObject *Py_UNUSED(ignored))
1284
0
{
1285
0
    return sys__clear_type_cache_impl(module);
1286
0
}
1287
1288
PyDoc_STRVAR(sys__clear_internal_caches__doc__,
1289
"_clear_internal_caches($module, /)\n"
1290
"--\n"
1291
"\n"
1292
"Clear all internal performance-related caches.");
1293
1294
#define SYS__CLEAR_INTERNAL_CACHES_METHODDEF    \
1295
    {"_clear_internal_caches", (PyCFunction)sys__clear_internal_caches, METH_NOARGS, sys__clear_internal_caches__doc__},
1296
1297
static PyObject *
1298
sys__clear_internal_caches_impl(PyObject *module);
1299
1300
static PyObject *
1301
sys__clear_internal_caches(PyObject *module, PyObject *Py_UNUSED(ignored))
1302
0
{
1303
0
    return sys__clear_internal_caches_impl(module);
1304
0
}
1305
1306
PyDoc_STRVAR(sys_is_finalizing__doc__,
1307
"is_finalizing($module, /)\n"
1308
"--\n"
1309
"\n"
1310
"Return True if Python is exiting.");
1311
1312
#define SYS_IS_FINALIZING_METHODDEF    \
1313
    {"is_finalizing", (PyCFunction)sys_is_finalizing, METH_NOARGS, sys_is_finalizing__doc__},
1314
1315
static PyObject *
1316
sys_is_finalizing_impl(PyObject *module);
1317
1318
static PyObject *
1319
sys_is_finalizing(PyObject *module, PyObject *Py_UNUSED(ignored))
1320
0
{
1321
0
    return sys_is_finalizing_impl(module);
1322
0
}
1323
1324
#if defined(Py_STATS)
1325
1326
PyDoc_STRVAR(sys__stats_on__doc__,
1327
"_stats_on($module, /)\n"
1328
"--\n"
1329
"\n"
1330
"Turns on stats gathering (stats gathering is off by default).");
1331
1332
#define SYS__STATS_ON_METHODDEF    \
1333
    {"_stats_on", (PyCFunction)sys__stats_on, METH_NOARGS, sys__stats_on__doc__},
1334
1335
static PyObject *
1336
sys__stats_on_impl(PyObject *module);
1337
1338
static PyObject *
1339
sys__stats_on(PyObject *module, PyObject *Py_UNUSED(ignored))
1340
{
1341
    return sys__stats_on_impl(module);
1342
}
1343
1344
#endif /* defined(Py_STATS) */
1345
1346
#if defined(Py_STATS)
1347
1348
PyDoc_STRVAR(sys__stats_off__doc__,
1349
"_stats_off($module, /)\n"
1350
"--\n"
1351
"\n"
1352
"Turns off stats gathering (stats gathering is off by default).");
1353
1354
#define SYS__STATS_OFF_METHODDEF    \
1355
    {"_stats_off", (PyCFunction)sys__stats_off, METH_NOARGS, sys__stats_off__doc__},
1356
1357
static PyObject *
1358
sys__stats_off_impl(PyObject *module);
1359
1360
static PyObject *
1361
sys__stats_off(PyObject *module, PyObject *Py_UNUSED(ignored))
1362
{
1363
    return sys__stats_off_impl(module);
1364
}
1365
1366
#endif /* defined(Py_STATS) */
1367
1368
#if defined(Py_STATS)
1369
1370
PyDoc_STRVAR(sys__stats_clear__doc__,
1371
"_stats_clear($module, /)\n"
1372
"--\n"
1373
"\n"
1374
"Clears the stats.");
1375
1376
#define SYS__STATS_CLEAR_METHODDEF    \
1377
    {"_stats_clear", (PyCFunction)sys__stats_clear, METH_NOARGS, sys__stats_clear__doc__},
1378
1379
static PyObject *
1380
sys__stats_clear_impl(PyObject *module);
1381
1382
static PyObject *
1383
sys__stats_clear(PyObject *module, PyObject *Py_UNUSED(ignored))
1384
{
1385
    return sys__stats_clear_impl(module);
1386
}
1387
1388
#endif /* defined(Py_STATS) */
1389
1390
#if defined(Py_STATS)
1391
1392
PyDoc_STRVAR(sys__stats_dump__doc__,
1393
"_stats_dump($module, /)\n"
1394
"--\n"
1395
"\n"
1396
"Dump stats to file, and clears the stats.\n"
1397
"\n"
1398
"Return False if no statistics were not dumped because stats gathering was off.");
1399
1400
#define SYS__STATS_DUMP_METHODDEF    \
1401
    {"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__},
1402
1403
static int
1404
sys__stats_dump_impl(PyObject *module);
1405
1406
static PyObject *
1407
sys__stats_dump(PyObject *module, PyObject *Py_UNUSED(ignored))
1408
{
1409
    PyObject *return_value = NULL;
1410
    int _return_value;
1411
1412
    _return_value = sys__stats_dump_impl(module);
1413
    if ((_return_value == -1) && PyErr_Occurred()) {
1414
        goto exit;
1415
    }
1416
    return_value = PyBool_FromLong((long)_return_value);
1417
1418
exit:
1419
    return return_value;
1420
}
1421
1422
#endif /* defined(Py_STATS) */
1423
1424
#if defined(ANDROID_API_LEVEL)
1425
1426
PyDoc_STRVAR(sys_getandroidapilevel__doc__,
1427
"getandroidapilevel($module, /)\n"
1428
"--\n"
1429
"\n"
1430
"Return the build time API version of Android as an integer.");
1431
1432
#define SYS_GETANDROIDAPILEVEL_METHODDEF    \
1433
    {"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS, sys_getandroidapilevel__doc__},
1434
1435
static PyObject *
1436
sys_getandroidapilevel_impl(PyObject *module);
1437
1438
static PyObject *
1439
sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
1440
{
1441
    return sys_getandroidapilevel_impl(module);
1442
}
1443
1444
#endif /* defined(ANDROID_API_LEVEL) */
1445
1446
PyDoc_STRVAR(sys_activate_stack_trampoline__doc__,
1447
"activate_stack_trampoline($module, backend, /)\n"
1448
"--\n"
1449
"\n"
1450
"Activate stack profiler trampoline *backend*.");
1451
1452
#define SYS_ACTIVATE_STACK_TRAMPOLINE_METHODDEF    \
1453
    {"activate_stack_trampoline", (PyCFunction)sys_activate_stack_trampoline, METH_O, sys_activate_stack_trampoline__doc__},
1454
1455
static PyObject *
1456
sys_activate_stack_trampoline_impl(PyObject *module, const char *backend);
1457
1458
static PyObject *
1459
sys_activate_stack_trampoline(PyObject *module, PyObject *arg)
1460
0
{
1461
0
    PyObject *return_value = NULL;
1462
0
    const char *backend;
1463
1464
0
    if (!PyUnicode_Check(arg)) {
1465
0
        _PyArg_BadArgument("activate_stack_trampoline", "argument", "str", arg);
1466
0
        goto exit;
1467
0
    }
1468
0
    Py_ssize_t backend_length;
1469
0
    backend = PyUnicode_AsUTF8AndSize(arg, &backend_length);
1470
0
    if (backend == NULL) {
1471
0
        goto exit;
1472
0
    }
1473
0
    if (strlen(backend) != (size_t)backend_length) {
1474
0
        PyErr_SetString(PyExc_ValueError, "embedded null character");
1475
0
        goto exit;
1476
0
    }
1477
0
    return_value = sys_activate_stack_trampoline_impl(module, backend);
1478
1479
0
exit:
1480
0
    return return_value;
1481
0
}
1482
1483
PyDoc_STRVAR(sys_deactivate_stack_trampoline__doc__,
1484
"deactivate_stack_trampoline($module, /)\n"
1485
"--\n"
1486
"\n"
1487
"Deactivate the current stack profiler trampoline backend.\n"
1488
"\n"
1489
"If no stack profiler is activated, this function has no effect.");
1490
1491
#define SYS_DEACTIVATE_STACK_TRAMPOLINE_METHODDEF    \
1492
    {"deactivate_stack_trampoline", (PyCFunction)sys_deactivate_stack_trampoline, METH_NOARGS, sys_deactivate_stack_trampoline__doc__},
1493
1494
static PyObject *
1495
sys_deactivate_stack_trampoline_impl(PyObject *module);
1496
1497
static PyObject *
1498
sys_deactivate_stack_trampoline(PyObject *module, PyObject *Py_UNUSED(ignored))
1499
0
{
1500
0
    return sys_deactivate_stack_trampoline_impl(module);
1501
0
}
1502
1503
PyDoc_STRVAR(sys_is_stack_trampoline_active__doc__,
1504
"is_stack_trampoline_active($module, /)\n"
1505
"--\n"
1506
"\n"
1507
"Return *True* if a stack profiler trampoline is active.");
1508
1509
#define SYS_IS_STACK_TRAMPOLINE_ACTIVE_METHODDEF    \
1510
    {"is_stack_trampoline_active", (PyCFunction)sys_is_stack_trampoline_active, METH_NOARGS, sys_is_stack_trampoline_active__doc__},
1511
1512
static PyObject *
1513
sys_is_stack_trampoline_active_impl(PyObject *module);
1514
1515
static PyObject *
1516
sys_is_stack_trampoline_active(PyObject *module, PyObject *Py_UNUSED(ignored))
1517
0
{
1518
0
    return sys_is_stack_trampoline_active_impl(module);
1519
0
}
1520
1521
PyDoc_STRVAR(sys_is_remote_debug_enabled__doc__,
1522
"is_remote_debug_enabled($module, /)\n"
1523
"--\n"
1524
"\n"
1525
"Return True if remote debugging is enabled, False otherwise.");
1526
1527
#define SYS_IS_REMOTE_DEBUG_ENABLED_METHODDEF    \
1528
    {"is_remote_debug_enabled", (PyCFunction)sys_is_remote_debug_enabled, METH_NOARGS, sys_is_remote_debug_enabled__doc__},
1529
1530
static PyObject *
1531
sys_is_remote_debug_enabled_impl(PyObject *module);
1532
1533
static PyObject *
1534
sys_is_remote_debug_enabled(PyObject *module, PyObject *Py_UNUSED(ignored))
1535
0
{
1536
0
    return sys_is_remote_debug_enabled_impl(module);
1537
0
}
1538
1539
PyDoc_STRVAR(sys_remote_exec__doc__,
1540
"remote_exec($module, /, pid, script)\n"
1541
"--\n"
1542
"\n"
1543
"Executes a file containing Python code in a given remote Python process.\n"
1544
"\n"
1545
"This function returns immediately, and the code will be executed by the\n"
1546
"target process\'s main thread at the next available opportunity, similarly\n"
1547
"to how signals are handled. There is no interface to determine when the\n"
1548
"code has been executed. The caller is responsible for making sure that\n"
1549
"the file still exists whenever the remote process tries to read it and that\n"
1550
"it hasn\'t been overwritten.\n"
1551
"\n"
1552
"The remote process must be running a CPython interpreter of the same major\n"
1553
"and minor version as the local process. If either the local or remote\n"
1554
"interpreter is pre-release (alpha, beta, or release candidate) then the\n"
1555
"local and remote interpreters must be the same exact version.\n"
1556
"\n"
1557
"Args:\n"
1558
"     pid (int): The process ID of the target Python process.\n"
1559
"     script (str|bytes): The path to a file containing\n"
1560
"         the Python code to be executed.");
1561
1562
#define SYS_REMOTE_EXEC_METHODDEF    \
1563
    {"remote_exec", _PyCFunction_CAST(sys_remote_exec), METH_FASTCALL|METH_KEYWORDS, sys_remote_exec__doc__},
1564
1565
static PyObject *
1566
sys_remote_exec_impl(PyObject *module, int pid, PyObject *script);
1567
1568
static PyObject *
1569
sys_remote_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1570
0
{
1571
0
    PyObject *return_value = NULL;
1572
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1573
1574
0
    #define NUM_KEYWORDS 2
1575
0
    static struct {
1576
0
        PyGC_Head _this_is_not_used;
1577
0
        PyObject_VAR_HEAD
1578
0
        Py_hash_t ob_hash;
1579
0
        PyObject *ob_item[NUM_KEYWORDS];
1580
0
    } _kwtuple = {
1581
0
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1582
0
        .ob_hash = -1,
1583
0
        .ob_item = { &_Py_ID(pid), &_Py_ID(script), },
1584
0
    };
1585
0
    #undef NUM_KEYWORDS
1586
0
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1587
1588
    #else  // !Py_BUILD_CORE
1589
    #  define KWTUPLE NULL
1590
    #endif  // !Py_BUILD_CORE
1591
1592
0
    static const char * const _keywords[] = {"pid", "script", NULL};
1593
0
    static _PyArg_Parser _parser = {
1594
0
        .keywords = _keywords,
1595
0
        .fname = "remote_exec",
1596
0
        .kwtuple = KWTUPLE,
1597
0
    };
1598
0
    #undef KWTUPLE
1599
0
    PyObject *argsbuf[2];
1600
0
    int pid;
1601
0
    PyObject *script;
1602
1603
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1604
0
            /*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1605
0
    if (!args) {
1606
0
        goto exit;
1607
0
    }
1608
0
    pid = PyLong_AsInt(args[0]);
1609
0
    if (pid == -1 && PyErr_Occurred()) {
1610
0
        goto exit;
1611
0
    }
1612
0
    script = args[1];
1613
0
    return_value = sys_remote_exec_impl(module, pid, script);
1614
1615
0
exit:
1616
0
    return return_value;
1617
0
}
1618
1619
PyDoc_STRVAR(sys__dump_tracelets__doc__,
1620
"_dump_tracelets($module, /, outpath)\n"
1621
"--\n"
1622
"\n"
1623
"Dump the graph of tracelets in graphviz format");
1624
1625
#define SYS__DUMP_TRACELETS_METHODDEF    \
1626
    {"_dump_tracelets", _PyCFunction_CAST(sys__dump_tracelets), METH_FASTCALL|METH_KEYWORDS, sys__dump_tracelets__doc__},
1627
1628
static PyObject *
1629
sys__dump_tracelets_impl(PyObject *module, PyObject *outpath);
1630
1631
static PyObject *
1632
sys__dump_tracelets(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1633
0
{
1634
0
    PyObject *return_value = NULL;
1635
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1636
1637
0
    #define NUM_KEYWORDS 1
1638
0
    static struct {
1639
0
        PyGC_Head _this_is_not_used;
1640
0
        PyObject_VAR_HEAD
1641
0
        Py_hash_t ob_hash;
1642
0
        PyObject *ob_item[NUM_KEYWORDS];
1643
0
    } _kwtuple = {
1644
0
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1645
0
        .ob_hash = -1,
1646
0
        .ob_item = { &_Py_ID(outpath), },
1647
0
    };
1648
0
    #undef NUM_KEYWORDS
1649
0
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1650
1651
    #else  // !Py_BUILD_CORE
1652
    #  define KWTUPLE NULL
1653
    #endif  // !Py_BUILD_CORE
1654
1655
0
    static const char * const _keywords[] = {"outpath", NULL};
1656
0
    static _PyArg_Parser _parser = {
1657
0
        .keywords = _keywords,
1658
0
        .fname = "_dump_tracelets",
1659
0
        .kwtuple = KWTUPLE,
1660
0
    };
1661
0
    #undef KWTUPLE
1662
0
    PyObject *argsbuf[1];
1663
0
    PyObject *outpath;
1664
1665
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1666
0
            /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1667
0
    if (!args) {
1668
0
        goto exit;
1669
0
    }
1670
0
    outpath = args[0];
1671
0
    return_value = sys__dump_tracelets_impl(module, outpath);
1672
1673
0
exit:
1674
0
    return return_value;
1675
0
}
1676
1677
PyDoc_STRVAR(sys__getframemodulename__doc__,
1678
"_getframemodulename($module, /, depth=0)\n"
1679
"--\n"
1680
"\n"
1681
"Return the name of the module for a calling frame.\n"
1682
"\n"
1683
"The default depth returns the module containing the call to this API.\n"
1684
"A more typical use in a library will pass a depth of 1 to get the user\'s\n"
1685
"module rather than the library module.\n"
1686
"\n"
1687
"If no frame, module, or name can be found, returns None.");
1688
1689
#define SYS__GETFRAMEMODULENAME_METHODDEF    \
1690
    {"_getframemodulename", _PyCFunction_CAST(sys__getframemodulename), METH_FASTCALL|METH_KEYWORDS, sys__getframemodulename__doc__},
1691
1692
static PyObject *
1693
sys__getframemodulename_impl(PyObject *module, int depth);
1694
1695
static PyObject *
1696
sys__getframemodulename(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1697
66
{
1698
66
    PyObject *return_value = NULL;
1699
66
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1700
1701
66
    #define NUM_KEYWORDS 1
1702
66
    static struct {
1703
66
        PyGC_Head _this_is_not_used;
1704
66
        PyObject_VAR_HEAD
1705
66
        Py_hash_t ob_hash;
1706
66
        PyObject *ob_item[NUM_KEYWORDS];
1707
66
    } _kwtuple = {
1708
66
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1709
66
        .ob_hash = -1,
1710
66
        .ob_item = { &_Py_ID(depth), },
1711
66
    };
1712
66
    #undef NUM_KEYWORDS
1713
66
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1714
1715
    #else  // !Py_BUILD_CORE
1716
    #  define KWTUPLE NULL
1717
    #endif  // !Py_BUILD_CORE
1718
1719
66
    static const char * const _keywords[] = {"depth", NULL};
1720
66
    static _PyArg_Parser _parser = {
1721
66
        .keywords = _keywords,
1722
66
        .fname = "_getframemodulename",
1723
66
        .kwtuple = KWTUPLE,
1724
66
    };
1725
66
    #undef KWTUPLE
1726
66
    PyObject *argsbuf[1];
1727
66
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
1728
66
    int depth = 0;
1729
1730
66
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1731
66
            /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1732
66
    if (!args) {
1733
0
        goto exit;
1734
0
    }
1735
66
    if (!noptargs) {
1736
0
        goto skip_optional_pos;
1737
0
    }
1738
66
    depth = PyLong_AsInt(args[0]);
1739
66
    if (depth == -1 && PyErr_Occurred()) {
1740
0
        goto exit;
1741
0
    }
1742
66
skip_optional_pos:
1743
66
    return_value = sys__getframemodulename_impl(module, depth);
1744
1745
66
exit:
1746
66
    return return_value;
1747
66
}
1748
1749
PyDoc_STRVAR(sys__get_cpu_count_config__doc__,
1750
"_get_cpu_count_config($module, /)\n"
1751
"--\n"
1752
"\n"
1753
"Private function for getting PyConfig.cpu_count");
1754
1755
#define SYS__GET_CPU_COUNT_CONFIG_METHODDEF    \
1756
    {"_get_cpu_count_config", (PyCFunction)sys__get_cpu_count_config, METH_NOARGS, sys__get_cpu_count_config__doc__},
1757
1758
static int
1759
sys__get_cpu_count_config_impl(PyObject *module);
1760
1761
static PyObject *
1762
sys__get_cpu_count_config(PyObject *module, PyObject *Py_UNUSED(ignored))
1763
16
{
1764
16
    PyObject *return_value = NULL;
1765
16
    int _return_value;
1766
1767
16
    _return_value = sys__get_cpu_count_config_impl(module);
1768
16
    if ((_return_value == -1) && PyErr_Occurred()) {
1769
0
        goto exit;
1770
0
    }
1771
16
    return_value = PyLong_FromLong((long)_return_value);
1772
1773
16
exit:
1774
16
    return return_value;
1775
16
}
1776
1777
PyDoc_STRVAR(sys__baserepl__doc__,
1778
"_baserepl($module, /)\n"
1779
"--\n"
1780
"\n"
1781
"Private function for getting the base REPL");
1782
1783
#define SYS__BASEREPL_METHODDEF    \
1784
    {"_baserepl", (PyCFunction)sys__baserepl, METH_NOARGS, sys__baserepl__doc__},
1785
1786
static PyObject *
1787
sys__baserepl_impl(PyObject *module);
1788
1789
static PyObject *
1790
sys__baserepl(PyObject *module, PyObject *Py_UNUSED(ignored))
1791
0
{
1792
0
    return sys__baserepl_impl(module);
1793
0
}
1794
1795
PyDoc_STRVAR(sys__is_gil_enabled__doc__,
1796
"_is_gil_enabled($module, /)\n"
1797
"--\n"
1798
"\n"
1799
"Return True if the GIL is currently enabled and False otherwise.");
1800
1801
#define SYS__IS_GIL_ENABLED_METHODDEF    \
1802
    {"_is_gil_enabled", (PyCFunction)sys__is_gil_enabled, METH_NOARGS, sys__is_gil_enabled__doc__},
1803
1804
static int
1805
sys__is_gil_enabled_impl(PyObject *module);
1806
1807
static PyObject *
1808
sys__is_gil_enabled(PyObject *module, PyObject *Py_UNUSED(ignored))
1809
0
{
1810
0
    PyObject *return_value = NULL;
1811
0
    int _return_value;
1812
1813
0
    _return_value = sys__is_gil_enabled_impl(module);
1814
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1815
0
        goto exit;
1816
0
    }
1817
0
    return_value = PyBool_FromLong((long)_return_value);
1818
1819
0
exit:
1820
0
    return return_value;
1821
0
}
1822
1823
PyDoc_STRVAR(_jit_is_available__doc__,
1824
"is_available($module, /)\n"
1825
"--\n"
1826
"\n"
1827
"Return True if the current Python executable supports JIT compilation, and False otherwise.");
1828
1829
#define _JIT_IS_AVAILABLE_METHODDEF    \
1830
    {"is_available", (PyCFunction)_jit_is_available, METH_NOARGS, _jit_is_available__doc__},
1831
1832
static int
1833
_jit_is_available_impl(PyObject *module);
1834
1835
static PyObject *
1836
_jit_is_available(PyObject *module, PyObject *Py_UNUSED(ignored))
1837
0
{
1838
0
    PyObject *return_value = NULL;
1839
0
    int _return_value;
1840
1841
0
    _return_value = _jit_is_available_impl(module);
1842
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1843
0
        goto exit;
1844
0
    }
1845
0
    return_value = PyBool_FromLong((long)_return_value);
1846
1847
0
exit:
1848
0
    return return_value;
1849
0
}
1850
1851
PyDoc_STRVAR(_jit_is_enabled__doc__,
1852
"is_enabled($module, /)\n"
1853
"--\n"
1854
"\n"
1855
"Return True if JIT compilation is enabled for the current Python process (implies sys._jit.is_available()), and False otherwise.");
1856
1857
#define _JIT_IS_ENABLED_METHODDEF    \
1858
    {"is_enabled", (PyCFunction)_jit_is_enabled, METH_NOARGS, _jit_is_enabled__doc__},
1859
1860
static int
1861
_jit_is_enabled_impl(PyObject *module);
1862
1863
static PyObject *
1864
_jit_is_enabled(PyObject *module, PyObject *Py_UNUSED(ignored))
1865
0
{
1866
0
    PyObject *return_value = NULL;
1867
0
    int _return_value;
1868
1869
0
    _return_value = _jit_is_enabled_impl(module);
1870
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1871
0
        goto exit;
1872
0
    }
1873
0
    return_value = PyBool_FromLong((long)_return_value);
1874
1875
0
exit:
1876
0
    return return_value;
1877
0
}
1878
1879
PyDoc_STRVAR(_jit_is_active__doc__,
1880
"is_active($module, /)\n"
1881
"--\n"
1882
"\n"
1883
"Return True if the topmost Python frame is currently executing JIT code (implies sys._jit.is_enabled()), and False otherwise.");
1884
1885
#define _JIT_IS_ACTIVE_METHODDEF    \
1886
    {"is_active", (PyCFunction)_jit_is_active, METH_NOARGS, _jit_is_active__doc__},
1887
1888
static int
1889
_jit_is_active_impl(PyObject *module);
1890
1891
static PyObject *
1892
_jit_is_active(PyObject *module, PyObject *Py_UNUSED(ignored))
1893
0
{
1894
0
    PyObject *return_value = NULL;
1895
0
    int _return_value;
1896
1897
0
    _return_value = _jit_is_active_impl(module);
1898
0
    if ((_return_value == -1) && PyErr_Occurred()) {
1899
0
        goto exit;
1900
0
    }
1901
0
    return_value = PyBool_FromLong((long)_return_value);
1902
1903
0
exit:
1904
0
    return return_value;
1905
0
}
1906
1907
#ifndef SYS_GETWINDOWSVERSION_METHODDEF
1908
    #define SYS_GETWINDOWSVERSION_METHODDEF
1909
#endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */
1910
1911
#ifndef SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF
1912
    #define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF
1913
#endif /* !defined(SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF) */
1914
1915
#ifndef SYS_SETDLOPENFLAGS_METHODDEF
1916
    #define SYS_SETDLOPENFLAGS_METHODDEF
1917
#endif /* !defined(SYS_SETDLOPENFLAGS_METHODDEF) */
1918
1919
#ifndef SYS_GETDLOPENFLAGS_METHODDEF
1920
    #define SYS_GETDLOPENFLAGS_METHODDEF
1921
#endif /* !defined(SYS_GETDLOPENFLAGS_METHODDEF) */
1922
1923
#ifndef SYS_MDEBUG_METHODDEF
1924
    #define SYS_MDEBUG_METHODDEF
1925
#endif /* !defined(SYS_MDEBUG_METHODDEF) */
1926
1927
#ifndef SYS_GETTOTALREFCOUNT_METHODDEF
1928
    #define SYS_GETTOTALREFCOUNT_METHODDEF
1929
#endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */
1930
1931
#ifndef SYS__STATS_ON_METHODDEF
1932
    #define SYS__STATS_ON_METHODDEF
1933
#endif /* !defined(SYS__STATS_ON_METHODDEF) */
1934
1935
#ifndef SYS__STATS_OFF_METHODDEF
1936
    #define SYS__STATS_OFF_METHODDEF
1937
#endif /* !defined(SYS__STATS_OFF_METHODDEF) */
1938
1939
#ifndef SYS__STATS_CLEAR_METHODDEF
1940
    #define SYS__STATS_CLEAR_METHODDEF
1941
#endif /* !defined(SYS__STATS_CLEAR_METHODDEF) */
1942
1943
#ifndef SYS__STATS_DUMP_METHODDEF
1944
    #define SYS__STATS_DUMP_METHODDEF
1945
#endif /* !defined(SYS__STATS_DUMP_METHODDEF) */
1946
1947
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
1948
    #define SYS_GETANDROIDAPILEVEL_METHODDEF
1949
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
1950
/*[clinic end generated code: output=5f7d84c5bf00d557 input=a9049054013a1b77]*/