Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Python/clinic/sysmodule.c.h
Line
Count
Source (jump to first uncovered line)
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 *
18
sys_addaudithook(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
19
0
{
20
0
    PyObject *return_value = NULL;
21
0
    static const char * const _keywords[] = {"hook", NULL};
22
0
    static _PyArg_Parser _parser = {NULL, _keywords, "addaudithook", 0};
23
0
    PyObject *argsbuf[1];
24
0
    PyObject *hook;
25
26
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
27
0
    if (!args) {
28
0
        goto exit;
29
0
    }
30
0
    hook = args[0];
31
0
    return_value = sys_addaudithook_impl(module, hook);
32
33
0
exit:
34
0
    return return_value;
35
0
}
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 *
60
sys_excepthook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
61
0
{
62
0
    PyObject *return_value = NULL;
63
0
    PyObject *exctype;
64
0
    PyObject *value;
65
0
    PyObject *traceback;
66
67
0
    if (!_PyArg_CheckPositional("excepthook", nargs, 3, 3)) {
68
0
        goto exit;
69
0
    }
70
0
    exctype = args[0];
71
0
    value = args[1];
72
0
    traceback = args[2];
73
0
    return_value = sys_excepthook_impl(module, exctype, value, traceback);
74
75
0
exit:
76
0
    return return_value;
77
0
}
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 *
95
sys_exc_info(PyObject *module, PyObject *Py_UNUSED(ignored))
96
15
{
97
15
    return sys_exc_info_impl(module);
98
15
}
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 *
135
sys_exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
136
0
{
137
0
    PyObject *return_value = NULL;
138
0
    PyObject *status = Py_None;
139
140
0
    if (!_PyArg_CheckPositional("exit", nargs, 0, 1)) {
141
0
        goto exit;
142
0
    }
143
0
    if (nargs < 1) {
144
0
        goto skip_optional;
145
0
    }
146
0
    status = args[0];
147
0
skip_optional:
148
0
    return_value = sys_exit_impl(module, status);
149
150
0
exit:
151
0
    return return_value;
152
0
}
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 *
167
sys_getdefaultencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
168
0
{
169
0
    return sys_getdefaultencoding_impl(module);
170
0
}
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 *
185
sys_getfilesystemencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
186
28
{
187
28
    return sys_getfilesystemencoding_impl(module);
188
28
}
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 *
203
sys_getfilesystemencodeerrors(PyObject *module, PyObject *Py_UNUSED(ignored))
204
14
{
205
14
    return sys_getfilesystemencodeerrors_impl(module);
206
14
}
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 *
225
sys_intern(PyObject *module, PyObject *arg)
226
20
{
227
20
    PyObject *return_value = NULL;
228
20
    PyObject *s;
229
230
20
    if (!PyUnicode_Check(arg)) {
231
0
        _PyArg_BadArgument("intern", "argument", "str", arg);
232
0
        goto exit;
233
0
    }
234
20
    if (PyUnicode_READY(arg) == -1) {
235
0
        goto exit;
236
0
    }
237
20
    s = arg;
238
20
    return_value = sys_intern_impl(module, s);
239
240
20
exit:
241
20
    return return_value;
242
20
}
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 *
259
sys_gettrace(PyObject *module, PyObject *Py_UNUSED(ignored))
260
0
{
261
0
    return sys_gettrace_impl(module);
262
0
}
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 *
279
sys_getprofile(PyObject *module, PyObject *Py_UNUSED(ignored))
280
0
{
281
0
    return sys_getprofile_impl(module);
282
0
}
283
284
PyDoc_STRVAR(sys_setcheckinterval__doc__,
285
"setcheckinterval($module, n, /)\n"
286
"--\n"
287
"\n"
288
"Set the async event check interval to n instructions.\n"
289
"\n"
290
"This tells the Python interpreter to check for asynchronous events\n"
291
"every n instructions.\n"
292
"\n"
293
"This also affects how often thread switches occur.");
294
295
#define SYS_SETCHECKINTERVAL_METHODDEF    \
296
    {"setcheckinterval", (PyCFunction)sys_setcheckinterval, METH_O, sys_setcheckinterval__doc__},
297
298
static PyObject *
299
sys_setcheckinterval_impl(PyObject *module, int n);
300
301
static PyObject *
302
sys_setcheckinterval(PyObject *module, PyObject *arg)
303
0
{
304
0
    PyObject *return_value = NULL;
305
0
    int n;
306
307
0
    if (PyFloat_Check(arg)) {
308
0
        PyErr_SetString(PyExc_TypeError,
309
0
                        "integer argument expected, got float" );
310
0
        goto exit;
311
0
    }
312
0
    n = _PyLong_AsInt(arg);
313
0
    if (n == -1 && PyErr_Occurred()) {
314
0
        goto exit;
315
0
    }
316
0
    return_value = sys_setcheckinterval_impl(module, n);
317
318
0
exit:
319
0
    return return_value;
320
0
}
321
322
PyDoc_STRVAR(sys_getcheckinterval__doc__,
323
"getcheckinterval($module, /)\n"
324
"--\n"
325
"\n"
326
"Return the current check interval; see sys.setcheckinterval().");
327
328
#define SYS_GETCHECKINTERVAL_METHODDEF    \
329
    {"getcheckinterval", (PyCFunction)sys_getcheckinterval, METH_NOARGS, sys_getcheckinterval__doc__},
330
331
static PyObject *
332
sys_getcheckinterval_impl(PyObject *module);
333
334
static PyObject *
335
sys_getcheckinterval(PyObject *module, PyObject *Py_UNUSED(ignored))
336
0
{
337
0
    return sys_getcheckinterval_impl(module);
338
0
}
339
340
PyDoc_STRVAR(sys_setswitchinterval__doc__,
341
"setswitchinterval($module, interval, /)\n"
342
"--\n"
343
"\n"
344
"Set the ideal thread switching delay inside the Python interpreter.\n"
345
"\n"
346
"The actual frequency of switching threads can be lower if the\n"
347
"interpreter executes long sequences of uninterruptible code\n"
348
"(this is implementation-specific and workload-dependent).\n"
349
"\n"
350
"The parameter must represent the desired switching delay in seconds\n"
351
"A typical value is 0.005 (5 milliseconds).");
352
353
#define SYS_SETSWITCHINTERVAL_METHODDEF    \
354
    {"setswitchinterval", (PyCFunction)sys_setswitchinterval, METH_O, sys_setswitchinterval__doc__},
355
356
static PyObject *
357
sys_setswitchinterval_impl(PyObject *module, double interval);
358
359
static PyObject *
360
sys_setswitchinterval(PyObject *module, PyObject *arg)
361
0
{
362
0
    PyObject *return_value = NULL;
363
0
    double interval;
364
365
0
    if (PyFloat_CheckExact(arg)) {
366
0
        interval = PyFloat_AS_DOUBLE(arg);
367
0
    }
368
0
    else
369
0
    {
370
0
        interval = PyFloat_AsDouble(arg);
371
0
        if (interval == -1.0 && PyErr_Occurred()) {
372
0
            goto exit;
373
0
        }
374
0
    }
375
0
    return_value = sys_setswitchinterval_impl(module, interval);
376
377
0
exit:
378
0
    return return_value;
379
0
}
380
381
PyDoc_STRVAR(sys_getswitchinterval__doc__,
382
"getswitchinterval($module, /)\n"
383
"--\n"
384
"\n"
385
"Return the current thread switch interval; see sys.setswitchinterval().");
386
387
#define SYS_GETSWITCHINTERVAL_METHODDEF    \
388
    {"getswitchinterval", (PyCFunction)sys_getswitchinterval, METH_NOARGS, sys_getswitchinterval__doc__},
389
390
static double
391
sys_getswitchinterval_impl(PyObject *module);
392
393
static PyObject *
394
sys_getswitchinterval(PyObject *module, PyObject *Py_UNUSED(ignored))
395
0
{
396
0
    PyObject *return_value = NULL;
397
0
    double _return_value;
398
399
0
    _return_value = sys_getswitchinterval_impl(module);
400
0
    if ((_return_value == -1.0) && PyErr_Occurred()) {
401
0
        goto exit;
402
0
    }
403
0
    return_value = PyFloat_FromDouble(_return_value);
404
405
0
exit:
406
0
    return return_value;
407
0
}
408
409
PyDoc_STRVAR(sys_setrecursionlimit__doc__,
410
"setrecursionlimit($module, limit, /)\n"
411
"--\n"
412
"\n"
413
"Set the maximum depth of the Python interpreter stack to n.\n"
414
"\n"
415
"This limit prevents infinite recursion from causing an overflow of the C\n"
416
"stack and crashing Python.  The highest possible limit is platform-\n"
417
"dependent.");
418
419
#define SYS_SETRECURSIONLIMIT_METHODDEF    \
420
    {"setrecursionlimit", (PyCFunction)sys_setrecursionlimit, METH_O, sys_setrecursionlimit__doc__},
421
422
static PyObject *
423
sys_setrecursionlimit_impl(PyObject *module, int new_limit);
424
425
static PyObject *
426
sys_setrecursionlimit(PyObject *module, PyObject *arg)
427
0
{
428
0
    PyObject *return_value = NULL;
429
0
    int new_limit;
430
431
0
    if (PyFloat_Check(arg)) {
432
0
        PyErr_SetString(PyExc_TypeError,
433
0
                        "integer argument expected, got float" );
434
0
        goto exit;
435
0
    }
436
0
    new_limit = _PyLong_AsInt(arg);
437
0
    if (new_limit == -1 && PyErr_Occurred()) {
438
0
        goto exit;
439
0
    }
440
0
    return_value = sys_setrecursionlimit_impl(module, new_limit);
441
442
0
exit:
443
0
    return return_value;
444
0
}
445
446
PyDoc_STRVAR(sys_set_coroutine_origin_tracking_depth__doc__,
447
"set_coroutine_origin_tracking_depth($module, /, depth)\n"
448
"--\n"
449
"\n"
450
"Enable or disable origin tracking for coroutine objects in this thread.\n"
451
"\n"
452
"Coroutine objects will track \'depth\' frames of traceback information\n"
453
"about where they came from, available in their cr_origin attribute.\n"
454
"\n"
455
"Set a depth of 0 to disable.");
456
457
#define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF    \
458
    {"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__},
459
460
static PyObject *
461
sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth);
462
463
static PyObject *
464
sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
465
0
{
466
0
    PyObject *return_value = NULL;
467
0
    static const char * const _keywords[] = {"depth", NULL};
468
0
    static _PyArg_Parser _parser = {NULL, _keywords, "set_coroutine_origin_tracking_depth", 0};
469
0
    PyObject *argsbuf[1];
470
0
    int depth;
471
472
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
473
0
    if (!args) {
474
0
        goto exit;
475
0
    }
476
0
    if (PyFloat_Check(args[0])) {
477
0
        PyErr_SetString(PyExc_TypeError,
478
0
                        "integer argument expected, got float" );
479
0
        goto exit;
480
0
    }
481
0
    depth = _PyLong_AsInt(args[0]);
482
0
    if (depth == -1 && PyErr_Occurred()) {
483
0
        goto exit;
484
0
    }
485
0
    return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth);
486
487
0
exit:
488
0
    return return_value;
489
0
}
490
491
PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__,
492
"get_coroutine_origin_tracking_depth($module, /)\n"
493
"--\n"
494
"\n"
495
"Check status of origin tracking for coroutine objects in this thread.");
496
497
#define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF    \
498
    {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__},
499
500
static int
501
sys_get_coroutine_origin_tracking_depth_impl(PyObject *module);
502
503
static PyObject *
504
sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored))
505
0
{
506
0
    PyObject *return_value = NULL;
507
0
    int _return_value;
508
509
0
    _return_value = sys_get_coroutine_origin_tracking_depth_impl(module);
510
0
    if ((_return_value == -1) && PyErr_Occurred()) {
511
0
        goto exit;
512
0
    }
513
0
    return_value = PyLong_FromLong((long)_return_value);
514
515
0
exit:
516
0
    return return_value;
517
0
}
518
519
PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__,
520
"get_asyncgen_hooks($module, /)\n"
521
"--\n"
522
"\n"
523
"Return the installed asynchronous generators hooks.\n"
524
"\n"
525
"This returns a namedtuple of the form (firstiter, finalizer).");
526
527
#define SYS_GET_ASYNCGEN_HOOKS_METHODDEF    \
528
    {"get_asyncgen_hooks", (PyCFunction)sys_get_asyncgen_hooks, METH_NOARGS, sys_get_asyncgen_hooks__doc__},
529
530
static PyObject *
531
sys_get_asyncgen_hooks_impl(PyObject *module);
532
533
static PyObject *
534
sys_get_asyncgen_hooks(PyObject *module, PyObject *Py_UNUSED(ignored))
535
0
{
536
0
    return sys_get_asyncgen_hooks_impl(module);
537
0
}
538
539
PyDoc_STRVAR(sys_getrecursionlimit__doc__,
540
"getrecursionlimit($module, /)\n"
541
"--\n"
542
"\n"
543
"Return the current value of the recursion limit.\n"
544
"\n"
545
"The recursion limit is the maximum depth of the Python interpreter\n"
546
"stack.  This limit prevents infinite recursion from causing an overflow\n"
547
"of the C stack and crashing Python.");
548
549
#define SYS_GETRECURSIONLIMIT_METHODDEF    \
550
    {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, sys_getrecursionlimit__doc__},
551
552
static PyObject *
553
sys_getrecursionlimit_impl(PyObject *module);
554
555
static PyObject *
556
sys_getrecursionlimit(PyObject *module, PyObject *Py_UNUSED(ignored))
557
0
{
558
0
    return sys_getrecursionlimit_impl(module);
559
0
}
560
561
#if defined(MS_WINDOWS)
562
563
PyDoc_STRVAR(sys_getwindowsversion__doc__,
564
"getwindowsversion($module, /)\n"
565
"--\n"
566
"\n"
567
"Return info about the running version of Windows as a named tuple.\n"
568
"\n"
569
"The members are named: major, minor, build, platform, service_pack,\n"
570
"service_pack_major, service_pack_minor, suite_mask, product_type and\n"
571
"platform_version. For backward compatibility, only the first 5 items\n"
572
"are available by indexing. All elements are numbers, except\n"
573
"service_pack and platform_type which are strings, and platform_version\n"
574
"which is a 3-tuple. Platform is always 2. Product_type may be 1 for a\n"
575
"workstation, 2 for a domain controller, 3 for a server.\n"
576
"Platform_version is a 3-tuple containing a version number that is\n"
577
"intended for identifying the OS rather than feature detection.");
578
579
#define SYS_GETWINDOWSVERSION_METHODDEF    \
580
    {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, sys_getwindowsversion__doc__},
581
582
static PyObject *
583
sys_getwindowsversion_impl(PyObject *module);
584
585
static PyObject *
586
sys_getwindowsversion(PyObject *module, PyObject *Py_UNUSED(ignored))
587
{
588
    return sys_getwindowsversion_impl(module);
589
}
590
591
#endif /* defined(MS_WINDOWS) */
592
593
#if defined(MS_WINDOWS)
594
595
PyDoc_STRVAR(sys__enablelegacywindowsfsencoding__doc__,
596
"_enablelegacywindowsfsencoding($module, /)\n"
597
"--\n"
598
"\n"
599
"Changes the default filesystem encoding to mbcs:replace.\n"
600
"\n"
601
"This is done for consistency with earlier versions of Python. See PEP\n"
602
"529 for more information.\n"
603
"\n"
604
"This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING\n"
605
"environment variable before launching Python.");
606
607
#define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF    \
608
    {"_enablelegacywindowsfsencoding", (PyCFunction)sys__enablelegacywindowsfsencoding, METH_NOARGS, sys__enablelegacywindowsfsencoding__doc__},
609
610
static PyObject *
611
sys__enablelegacywindowsfsencoding_impl(PyObject *module);
612
613
static PyObject *
614
sys__enablelegacywindowsfsencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
615
{
616
    return sys__enablelegacywindowsfsencoding_impl(module);
617
}
618
619
#endif /* defined(MS_WINDOWS) */
620
621
#if defined(HAVE_DLOPEN)
622
623
PyDoc_STRVAR(sys_setdlopenflags__doc__,
624
"setdlopenflags($module, flags, /)\n"
625
"--\n"
626
"\n"
627
"Set the flags used by the interpreter for dlopen calls.\n"
628
"\n"
629
"This is used, for example, when the interpreter loads extension\n"
630
"modules. Among other things, this will enable a lazy resolving of\n"
631
"symbols when importing a module, if called as sys.setdlopenflags(0).\n"
632
"To share symbols across extension modules, call as\n"
633
"sys.setdlopenflags(os.RTLD_GLOBAL).  Symbolic names for the flag\n"
634
"modules can be found in the os module (RTLD_xxx constants, e.g.\n"
635
"os.RTLD_LAZY).");
636
637
#define SYS_SETDLOPENFLAGS_METHODDEF    \
638
    {"setdlopenflags", (PyCFunction)sys_setdlopenflags, METH_O, sys_setdlopenflags__doc__},
639
640
static PyObject *
641
sys_setdlopenflags_impl(PyObject *module, int new_val);
642
643
static PyObject *
644
sys_setdlopenflags(PyObject *module, PyObject *arg)
645
0
{
646
0
    PyObject *return_value = NULL;
647
0
    int new_val;
648
649
0
    if (PyFloat_Check(arg)) {
650
0
        PyErr_SetString(PyExc_TypeError,
651
0
                        "integer argument expected, got float" );
652
0
        goto exit;
653
0
    }
654
0
    new_val = _PyLong_AsInt(arg);
655
0
    if (new_val == -1 && PyErr_Occurred()) {
656
0
        goto exit;
657
0
    }
658
0
    return_value = sys_setdlopenflags_impl(module, new_val);
659
660
0
exit:
661
0
    return return_value;
662
0
}
663
664
#endif /* defined(HAVE_DLOPEN) */
665
666
#if defined(HAVE_DLOPEN)
667
668
PyDoc_STRVAR(sys_getdlopenflags__doc__,
669
"getdlopenflags($module, /)\n"
670
"--\n"
671
"\n"
672
"Return the current value of the flags that are used for dlopen calls.\n"
673
"\n"
674
"The flag constants are defined in the os module.");
675
676
#define SYS_GETDLOPENFLAGS_METHODDEF    \
677
    {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, sys_getdlopenflags__doc__},
678
679
static PyObject *
680
sys_getdlopenflags_impl(PyObject *module);
681
682
static PyObject *
683
sys_getdlopenflags(PyObject *module, PyObject *Py_UNUSED(ignored))
684
0
{
685
0
    return sys_getdlopenflags_impl(module);
686
0
}
687
688
#endif /* defined(HAVE_DLOPEN) */
689
690
#if defined(USE_MALLOPT)
691
692
PyDoc_STRVAR(sys_mdebug__doc__,
693
"mdebug($module, flag, /)\n"
694
"--\n"
695
"\n");
696
697
#define SYS_MDEBUG_METHODDEF    \
698
    {"mdebug", (PyCFunction)sys_mdebug, METH_O, sys_mdebug__doc__},
699
700
static PyObject *
701
sys_mdebug_impl(PyObject *module, int flag);
702
703
static PyObject *
704
sys_mdebug(PyObject *module, PyObject *arg)
705
{
706
    PyObject *return_value = NULL;
707
    int flag;
708
709
    if (PyFloat_Check(arg)) {
710
        PyErr_SetString(PyExc_TypeError,
711
                        "integer argument expected, got float" );
712
        goto exit;
713
    }
714
    flag = _PyLong_AsInt(arg);
715
    if (flag == -1 && PyErr_Occurred()) {
716
        goto exit;
717
    }
718
    return_value = sys_mdebug_impl(module, flag);
719
720
exit:
721
    return return_value;
722
}
723
724
#endif /* defined(USE_MALLOPT) */
725
726
PyDoc_STRVAR(sys_getrefcount__doc__,
727
"getrefcount($module, object, /)\n"
728
"--\n"
729
"\n"
730
"Return the reference count of object.\n"
731
"\n"
732
"The count returned is generally one higher than you might expect,\n"
733
"because it includes the (temporary) reference as an argument to\n"
734
"getrefcount().");
735
736
#define SYS_GETREFCOUNT_METHODDEF    \
737
    {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, sys_getrefcount__doc__},
738
739
static Py_ssize_t
740
sys_getrefcount_impl(PyObject *module, PyObject *object);
741
742
static PyObject *
743
sys_getrefcount(PyObject *module, PyObject *object)
744
0
{
745
0
    PyObject *return_value = NULL;
746
0
    Py_ssize_t _return_value;
747
748
0
    _return_value = sys_getrefcount_impl(module, object);
749
0
    if ((_return_value == -1) && PyErr_Occurred()) {
750
0
        goto exit;
751
0
    }
752
0
    return_value = PyLong_FromSsize_t(_return_value);
753
754
0
exit:
755
0
    return return_value;
756
0
}
757
758
#if defined(Py_REF_DEBUG)
759
760
PyDoc_STRVAR(sys_gettotalrefcount__doc__,
761
"gettotalrefcount($module, /)\n"
762
"--\n"
763
"\n");
764
765
#define SYS_GETTOTALREFCOUNT_METHODDEF    \
766
    {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS, sys_gettotalrefcount__doc__},
767
768
static Py_ssize_t
769
sys_gettotalrefcount_impl(PyObject *module);
770
771
static PyObject *
772
sys_gettotalrefcount(PyObject *module, PyObject *Py_UNUSED(ignored))
773
{
774
    PyObject *return_value = NULL;
775
    Py_ssize_t _return_value;
776
777
    _return_value = sys_gettotalrefcount_impl(module);
778
    if ((_return_value == -1) && PyErr_Occurred()) {
779
        goto exit;
780
    }
781
    return_value = PyLong_FromSsize_t(_return_value);
782
783
exit:
784
    return return_value;
785
}
786
787
#endif /* defined(Py_REF_DEBUG) */
788
789
PyDoc_STRVAR(sys_getallocatedblocks__doc__,
790
"getallocatedblocks($module, /)\n"
791
"--\n"
792
"\n"
793
"Return the number of memory blocks currently allocated.");
794
795
#define SYS_GETALLOCATEDBLOCKS_METHODDEF    \
796
    {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS, sys_getallocatedblocks__doc__},
797
798
static Py_ssize_t
799
sys_getallocatedblocks_impl(PyObject *module);
800
801
static PyObject *
802
sys_getallocatedblocks(PyObject *module, PyObject *Py_UNUSED(ignored))
803
0
{
804
0
    PyObject *return_value = NULL;
805
0
    Py_ssize_t _return_value;
806
807
0
    _return_value = sys_getallocatedblocks_impl(module);
808
0
    if ((_return_value == -1) && PyErr_Occurred()) {
809
0
        goto exit;
810
0
    }
811
0
    return_value = PyLong_FromSsize_t(_return_value);
812
813
0
exit:
814
0
    return return_value;
815
0
}
816
817
#if defined(COUNT_ALLOCS)
818
819
PyDoc_STRVAR(sys_getcounts__doc__,
820
"getcounts($module, /)\n"
821
"--\n"
822
"\n");
823
824
#define SYS_GETCOUNTS_METHODDEF    \
825
    {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS, sys_getcounts__doc__},
826
827
static PyObject *
828
sys_getcounts_impl(PyObject *module);
829
830
static PyObject *
831
sys_getcounts(PyObject *module, PyObject *Py_UNUSED(ignored))
832
{
833
    return sys_getcounts_impl(module);
834
}
835
836
#endif /* defined(COUNT_ALLOCS) */
837
838
PyDoc_STRVAR(sys__getframe__doc__,
839
"_getframe($module, depth=0, /)\n"
840
"--\n"
841
"\n"
842
"Return a frame object from the call stack.\n"
843
"\n"
844
"If optional integer depth is given, return the frame object that many\n"
845
"calls below the top of the stack.  If that is deeper than the call\n"
846
"stack, ValueError is raised.  The default for depth is zero, returning\n"
847
"the frame at the top of the call stack.\n"
848
"\n"
849
"This function should be used for internal and specialized purposes\n"
850
"only.");
851
852
#define SYS__GETFRAME_METHODDEF    \
853
    {"_getframe", (PyCFunction)(void(*)(void))sys__getframe, METH_FASTCALL, sys__getframe__doc__},
854
855
static PyObject *
856
sys__getframe_impl(PyObject *module, int depth);
857
858
static PyObject *
859
sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
860
16
{
861
16
    PyObject *return_value = NULL;
862
16
    int depth = 0;
863
864
16
    if (!_PyArg_CheckPositional("_getframe", nargs, 0, 1)) {
865
0
        goto exit;
866
0
    }
867
16
    if (nargs < 1) {
868
0
        goto skip_optional;
869
0
    }
870
16
    if (PyFloat_Check(args[0])) {
871
0
        PyErr_SetString(PyExc_TypeError,
872
0
                        "integer argument expected, got float" );
873
0
        goto exit;
874
0
    }
875
16
    depth = _PyLong_AsInt(args[0]);
876
16
    if (depth == -1 && PyErr_Occurred()) {
877
0
        goto exit;
878
0
    }
879
16
skip_optional:
880
16
    return_value = sys__getframe_impl(module, depth);
881
882
16
exit:
883
16
    return return_value;
884
16
}
885
886
PyDoc_STRVAR(sys__current_frames__doc__,
887
"_current_frames($module, /)\n"
888
"--\n"
889
"\n"
890
"Return a dict mapping each thread\'s thread id to its current stack frame.\n"
891
"\n"
892
"This function should be used for specialized purposes only.");
893
894
#define SYS__CURRENT_FRAMES_METHODDEF    \
895
    {"_current_frames", (PyCFunction)sys__current_frames, METH_NOARGS, sys__current_frames__doc__},
896
897
static PyObject *
898
sys__current_frames_impl(PyObject *module);
899
900
static PyObject *
901
sys__current_frames(PyObject *module, PyObject *Py_UNUSED(ignored))
902
0
{
903
0
    return sys__current_frames_impl(module);
904
0
}
905
906
PyDoc_STRVAR(sys_call_tracing__doc__,
907
"call_tracing($module, func, args, /)\n"
908
"--\n"
909
"\n"
910
"Call func(*args), while tracing is enabled.\n"
911
"\n"
912
"The tracing state is saved, and restored afterwards.  This is intended\n"
913
"to be called from a debugger from a checkpoint, to recursively debug\n"
914
"some other code.");
915
916
#define SYS_CALL_TRACING_METHODDEF    \
917
    {"call_tracing", (PyCFunction)(void(*)(void))sys_call_tracing, METH_FASTCALL, sys_call_tracing__doc__},
918
919
static PyObject *
920
sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs);
921
922
static PyObject *
923
sys_call_tracing(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
924
0
{
925
0
    PyObject *return_value = NULL;
926
0
    PyObject *func;
927
0
    PyObject *funcargs;
928
929
0
    if (!_PyArg_CheckPositional("call_tracing", nargs, 2, 2)) {
930
0
        goto exit;
931
0
    }
932
0
    func = args[0];
933
0
    if (!PyTuple_Check(args[1])) {
934
0
        _PyArg_BadArgument("call_tracing", "argument 2", "tuple", args[1]);
935
0
        goto exit;
936
0
    }
937
0
    funcargs = args[1];
938
0
    return_value = sys_call_tracing_impl(module, func, funcargs);
939
940
0
exit:
941
0
    return return_value;
942
0
}
943
944
PyDoc_STRVAR(sys_callstats__doc__,
945
"callstats($module, /)\n"
946
"--\n"
947
"\n"
948
"Return a tuple of function call statistics.\n"
949
"\n"
950
"A tuple is returned only if CALL_PROFILE was defined when Python was\n"
951
"built.  Otherwise, this returns None.\n"
952
"\n"
953
"When enabled, this function returns detailed, implementation-specific\n"
954
"details about the number of function calls executed. The return value\n"
955
"is a 11-tuple where the entries in the tuple are counts of:\n"
956
"0. all function calls\n"
957
"1. calls to PyFunction_Type objects\n"
958
"2. PyFunction calls that do not create an argument tuple\n"
959
"3. PyFunction calls that do not create an argument tuple\n"
960
"   and bypass PyEval_EvalCodeEx()\n"
961
"4. PyMethod calls\n"
962
"5. PyMethod calls on bound methods\n"
963
"6. PyType calls\n"
964
"7. PyCFunction calls\n"
965
"8. generator calls\n"
966
"9. All other calls\n"
967
"10. Number of stack pops performed by call_function()");
968
969
#define SYS_CALLSTATS_METHODDEF    \
970
    {"callstats", (PyCFunction)sys_callstats, METH_NOARGS, sys_callstats__doc__},
971
972
static PyObject *
973
sys_callstats_impl(PyObject *module);
974
975
static PyObject *
976
sys_callstats(PyObject *module, PyObject *Py_UNUSED(ignored))
977
0
{
978
0
    return sys_callstats_impl(module);
979
0
}
980
981
PyDoc_STRVAR(sys__debugmallocstats__doc__,
982
"_debugmallocstats($module, /)\n"
983
"--\n"
984
"\n"
985
"Print summary info to stderr about the state of pymalloc\'s structures.\n"
986
"\n"
987
"In Py_DEBUG mode, also perform some expensive internal consistency\n"
988
"checks.");
989
990
#define SYS__DEBUGMALLOCSTATS_METHODDEF    \
991
    {"_debugmallocstats", (PyCFunction)sys__debugmallocstats, METH_NOARGS, sys__debugmallocstats__doc__},
992
993
static PyObject *
994
sys__debugmallocstats_impl(PyObject *module);
995
996
static PyObject *
997
sys__debugmallocstats(PyObject *module, PyObject *Py_UNUSED(ignored))
998
0
{
999
0
    return sys__debugmallocstats_impl(module);
1000
0
}
1001
1002
PyDoc_STRVAR(sys__clear_type_cache__doc__,
1003
"_clear_type_cache($module, /)\n"
1004
"--\n"
1005
"\n"
1006
"Clear the internal type lookup cache.");
1007
1008
#define SYS__CLEAR_TYPE_CACHE_METHODDEF    \
1009
    {"_clear_type_cache", (PyCFunction)sys__clear_type_cache, METH_NOARGS, sys__clear_type_cache__doc__},
1010
1011
static PyObject *
1012
sys__clear_type_cache_impl(PyObject *module);
1013
1014
static PyObject *
1015
sys__clear_type_cache(PyObject *module, PyObject *Py_UNUSED(ignored))
1016
0
{
1017
0
    return sys__clear_type_cache_impl(module);
1018
0
}
1019
1020
PyDoc_STRVAR(sys_is_finalizing__doc__,
1021
"is_finalizing($module, /)\n"
1022
"--\n"
1023
"\n"
1024
"Return True if Python is exiting.");
1025
1026
#define SYS_IS_FINALIZING_METHODDEF    \
1027
    {"is_finalizing", (PyCFunction)sys_is_finalizing, METH_NOARGS, sys_is_finalizing__doc__},
1028
1029
static PyObject *
1030
sys_is_finalizing_impl(PyObject *module);
1031
1032
static PyObject *
1033
sys_is_finalizing(PyObject *module, PyObject *Py_UNUSED(ignored))
1034
0
{
1035
0
    return sys_is_finalizing_impl(module);
1036
0
}
1037
1038
#if defined(ANDROID_API_LEVEL)
1039
1040
PyDoc_STRVAR(sys_getandroidapilevel__doc__,
1041
"getandroidapilevel($module, /)\n"
1042
"--\n"
1043
"\n"
1044
"Return the build time API version of Android as an integer.");
1045
1046
#define SYS_GETANDROIDAPILEVEL_METHODDEF    \
1047
    {"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS, sys_getandroidapilevel__doc__},
1048
1049
static PyObject *
1050
sys_getandroidapilevel_impl(PyObject *module);
1051
1052
static PyObject *
1053
sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
1054
{
1055
    return sys_getandroidapilevel_impl(module);
1056
}
1057
1058
#endif /* defined(ANDROID_API_LEVEL) */
1059
1060
#ifndef SYS_GETWINDOWSVERSION_METHODDEF
1061
    #define SYS_GETWINDOWSVERSION_METHODDEF
1062
#endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */
1063
1064
#ifndef SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF
1065
    #define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF
1066
#endif /* !defined(SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF) */
1067
1068
#ifndef SYS_SETDLOPENFLAGS_METHODDEF
1069
    #define SYS_SETDLOPENFLAGS_METHODDEF
1070
#endif /* !defined(SYS_SETDLOPENFLAGS_METHODDEF) */
1071
1072
#ifndef SYS_GETDLOPENFLAGS_METHODDEF
1073
    #define SYS_GETDLOPENFLAGS_METHODDEF
1074
#endif /* !defined(SYS_GETDLOPENFLAGS_METHODDEF) */
1075
1076
#ifndef SYS_MDEBUG_METHODDEF
1077
    #define SYS_MDEBUG_METHODDEF
1078
#endif /* !defined(SYS_MDEBUG_METHODDEF) */
1079
1080
#ifndef SYS_GETTOTALREFCOUNT_METHODDEF
1081
    #define SYS_GETTOTALREFCOUNT_METHODDEF
1082
#endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */
1083
1084
#ifndef SYS_GETCOUNTS_METHODDEF
1085
    #define SYS_GETCOUNTS_METHODDEF
1086
#endif /* !defined(SYS_GETCOUNTS_METHODDEF) */
1087
1088
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
1089
    #define SYS_GETANDROIDAPILEVEL_METHODDEF
1090
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
1091
/*[clinic end generated code: output=273f9cec8bfcab91 input=a9049054013a1b77]*/