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