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