1#!/usr/bin/env python2.7 2# -*- coding: utf-8 -*- 3""":synopsis: Access system-specific parameters and functions. 4 5 6This module provides access to some variables used or maintained by the 7interpreter and to functions that interact strongly with the interpreter. It is 8always available. 9 10 11""" 12""" 13The list of command line arguments passed to a Python script. ``argv[0]`` is the 14script name (it is operating system dependent whether this is a full pathname or 15not). If the command was executed using the :option:`-c` command line option to 16the interpreter, ``argv[0]`` is set to the string ``'-c'``. If no script name 17was passed to the Python interpreter, ``argv[0]`` is the empty string. 18 19To loop over the standard input, or the list of files given on the 20command line, see the :mod:`fileinput` module. 21 22 23""" 24argv = [str()] 25""" 26An indicator of the native byte order. This will have the value ``'big'`` on 27big-endian (most-significant byte first) platforms, and ``'little'`` on 28little-endian (least-significant byte first) platforms. 29 30""" 31byteorder = str() 32""" 33A triple (repo, branch, version) representing the Subversion information of the 34Python interpreter. *repo* is the name of the repository, ``'CPython'``. 35*branch* is a string of one of the forms ``'trunk'``, ``'branches/name'`` or 36``'tags/name'``. *version* is the output of ``svnversion``, if the interpreter 37was built from a Subversion checkout; it contains the revision number (range) 38and possibly a trailing 'M' if there were local modifications. If the tree was 39exported (or svnversion was not available), it is the revision of 40``Include/patchlevel.h`` if the branch is a tag. Otherwise, it is ``None``. 41 42""" 43subversion = (str(), str(), str()) 44""" 45A tuple of strings giving the names of all modules that are compiled into this 46Python interpreter. (This information is not available in any other way --- 47``modules.keys()`` only lists the imported modules.) 48 49 50""" 51builtin_module_names = (str()) 52""" 53A string containing the copyright pertaining to the Python interpreter. 54 55 56""" 57copyright = str() 58""" 59Integer specifying the handle of the Python DLL. Availability: Windows. 60 61 62""" 63dllhandle = int() 64"""__excepthook__ 65 66These objects contain the original values of ``displayhook`` and ``excepthook`` 67at the start of the program. They are saved so that ``displayhook`` and 68``excepthook`` can be restored in case they happen to get replaced with broken 69objects. 70 71 72""" 73__displayhook__ = None 74exc_value = None 75exc_traceback = None 76exc_type = None 77""" 78A string giving the site-specific directory prefix where the platform-dependent 79Python files are installed; by default, this is also ``'/usr/local'``. This can 80be set at build time with the ``--exec-prefix`` argument to the 81:program:`configure` script. Specifically, all configuration files (e.g. the 82:file:`pyconfig.h` header file) are installed in the directory ``exec_prefix + 83'/lib/pythonversion/config'``, and shared library modules are installed in 84``exec_prefix + '/lib/pythonversion/lib-dynload'``, where *version* is equal to 85``version[:3]``. 86 87 88""" 89exec_prefix = str() 90""" 91A string giving the name of the executable binary for the Python interpreter, on 92systems where this makes sense. 93 94 95""" 96executable = str() 97""" 98This value is not actually defined by the module, but can be set by the user (or 99by a program) to specify a clean-up action at program exit. When set, it should 100be a parameterless function. This function will be called when the interpreter 101exits. Only one function may be installed in this way; to allow multiple 102functions which will be called at termination, use the :mod:`atexit` module. 103 104""" 105exitfunc = lambda: None 106""" 107The struct sequence *flags* exposes the status of command line flags. The 108attributes are read only. 109 110============================= =================================== 111attribute flag 112============================= =================================== 113:const:`debug` :option:`-d` 114:const:`py3k_warning` :option:`-3` 115:const:`division_warning` :option:`-Q` 116:const:`division_new` :option:`-Qnew <-Q>` 117:const:`inspect` :option:`-i` 118:const:`interactive` :option:`-i` 119:const:`optimize` :option:`-O` or :option:`-OO` 120:const:`dont_write_bytecode` :option:`-B` 121:const:`no_user_site` :option:`-s` 122:const:`no_site` :option:`-S` 123:const:`ignore_environment` :option:`-E` 124:const:`tabcheck` :option:`-t` or :option:`-tt <-t>` 125:const:`verbose` :option:`-v` 126:const:`unicode` :option:`-U` 127:const:`bytes_warning` :option:`-b` 128============================= =================================== 129 130""" 131flags = None 132""" 133A structseq holding information about the float type. It contains low level 134information about the precision and internal representation. The values 135correspond to the various floating-point constants defined in the standard 136header file :file:`float.h` for the 'C' programming language; see section 1375.2.4.2.2 of the 1999 ISO/IEC C standard [C99]_, 'Characteristics of 138floating types', for details. 139 140+---------------------+----------------+--------------------------------------------------+ 141| attribute | float.h macro | explanation | 142+=====================+================+==================================================+ 143| :const:`epsilon` | DBL_EPSILON | difference between 1 and the least value greater | 144| | | than 1 that is representable as a float | 145+---------------------+----------------+--------------------------------------------------+ 146| :const:`dig` | DBL_DIG | maximum number of decimal digits that can be | 147| | | faithfully represented in a float; see below | 148+---------------------+----------------+--------------------------------------------------+ 149| :const:`mant_dig` | DBL_MANT_DIG | float precision: the number of base-``radix`` | 150| | | digits in the significand of a float | 151+---------------------+----------------+--------------------------------------------------+ 152| :const:`max` | DBL_MAX | maximum representable finite float | 153+---------------------+----------------+--------------------------------------------------+ 154| :const:`max_exp` | DBL_MAX_EXP | maximum integer e such that ``radix**(e-1)`` is | 155| | | a representable finite float | 156+---------------------+----------------+--------------------------------------------------+ 157| :const:`max_10_exp` | DBL_MAX_10_EXP | maximum integer e such that ``10**e`` is in the | 158| | | range of representable finite floats | 159+---------------------+----------------+--------------------------------------------------+ 160| :const:`min` | DBL_MIN | minimum positive normalized float | 161+---------------------+----------------+--------------------------------------------------+ 162| :const:`min_exp` | DBL_MIN_EXP | minimum integer e such that ``radix**(e-1)`` is | 163| | | a normalized float | 164+---------------------+----------------+--------------------------------------------------+ 165| :const:`min_10_exp` | DBL_MIN_10_EXP | minimum integer e such that ``10**e`` is a | 166| | | normalized float | 167+---------------------+----------------+--------------------------------------------------+ 168| :const:`radix` | FLT_RADIX | radix of exponent representation | 169+---------------------+----------------+--------------------------------------------------+ 170| :const:`rounds` | FLT_ROUNDS | constant representing rounding mode | 171| | | used for arithmetic operations | 172+---------------------+----------------+--------------------------------------------------+ 173 174The attribute :attr:`sys.float_info.dig` needs further explanation. If 175``s`` is any string representing a decimal number with at most 176:attr:`sys.float_info.dig` significant digits, then converting ``s`` to a 177float and back again will recover a string representing the same decimal 178value:: 179 180>>> import sys 181>>> sys.float_info.dig 18215 183>>> s = '3.14159265358979' # decimal string with 15 significant digits 184>>> format(float(s), '.15g') # convert to float and back -> same value 185'3.14159265358979' 186 187But for strings with more than :attr:`sys.float_info.dig` significant digits, 188this isn't always true:: 189 190>>> s = '9876543211234567' # 16 significant digits is too many! 191>>> format(float(s), '.16g') # conversion changes value 192'9876543211234568' 193 194""" 195float_info = None 196""" 197A string indicating how the :func:`repr` function behaves for 198floats. If the string has value ``'short'`` then for a finite 199float ``x``, ``repr(x)`` aims to produce a short string with the 200property that ``float(repr(x)) == x``. This is the usual behaviour 201in Python 2.7 and later. Otherwise, ``float_repr_style`` has value 202``'legacy'`` and ``repr(x)`` behaves in the same way as it did in 203versions of Python prior to 2.7. 204 205""" 206float_repr_style = str() 207""" 208The version number encoded as a single integer. This is guaranteed to increase 209with each version, including proper support for non-production releases. For 210example, to test that the Python interpreter is at least version 1.5.2, use:: 211 212if sys.hexversion >= 0x010502F0: 213# use some advanced feature 214more 215else: 216# use an alternative implementation or warn the user 217more 218 219This is called ``hexversion`` since it only really looks meaningful when viewed 220as the result of passing it to the built-in :func:`hex` function. The 221``version_info`` value may be used for a more human-friendly encoding of the 222same information. 223 224The ``hexversion`` is a 32-bit number with the following layout: 225 226+-------------------------+------------------------------------------------+ 227| Bits (big endian order) | Meaning | 228+=========================+================================================+ 229| :const:`1-8` | ``PY_MAJOR_VERSION`` (the ``2`` in | 230| | ``2.1.0a3``) | 231+-------------------------+------------------------------------------------+ 232| :const:`9-16` | ``PY_MINOR_VERSION`` (the ``1`` in | 233| | ``2.1.0a3``) | 234+-------------------------+------------------------------------------------+ 235| :const:`17-24` | ``PY_MICRO_VERSION`` (the ``0`` in | 236| | ``2.1.0a3``) | 237+-------------------------+------------------------------------------------+ 238| :const:`25-28` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | 239| | ``0xB`` for beta, ``0xC`` for release | 240| | candidate and ``0xF`` for final) | 241+-------------------------+------------------------------------------------+ 242| :const:`29-32` | ``PY_RELEASE_SERIAL`` (the ``3`` in | 243| | ``2.1.0a3``, zero for final releases) | 244+-------------------------+------------------------------------------------+ 245 246Thus ``2.1.0a3`` is hexversion ``0x020100a3``. 247 248""" 249hexversion = str() 250""" 251A struct sequence that holds information about Python's 252internal representation of integers. The attributes are read only. 253 254+-------------------------+----------------------------------------------+ 255| Attribute | Explanation | 256+=========================+==============================================+ 257| :const:`bits_per_digit` | number of bits held in each digit. Python | 258| | integers are stored internally in base | 259| | ``2**long_info.bits_per_digit`` | 260+-------------------------+----------------------------------------------+ 261| :const:`sizeof_digit` | size in bytes of the C type used to | 262| | represent a digit | 263+-------------------------+----------------------------------------------+ 264 265""" 266long_info = None 267""" 268These three variables are not always defined; they are set when an exception is 269not handled and the interpreter prints an error message and a stack traceback. 270Their intended use is to allow an interactive user to import a debugger module 271and engage in post-mortem debugging without having to re-execute the command 272that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the 273post-mortem debugger; see chapter :ref:`debugger` for 274more information.) 275 276The meaning of the variables is the same as that of the return values from 277:func:`exc_info` above. (Since there is only one interactive thread, 278thread-safety is not a concern for these variables, unlike for ``exc_type`` 279etc.) 280 281 282""" 283last_traceback = None 284last_value = None 285last_type = None 286""" 287The largest positive integer supported by Python's regular integer type. This 288is at least 2\*\*31-1. The largest negative integer is ``-maxint-1`` --- the 289asymmetry results from the use of 2's complement binary arithmetic. 290 291""" 292maxint = int() 293""" 294The largest positive integer supported by the platform's Py_ssize_t type, 295and thus the maximum size lists, strings, dicts, and many other containers 296can have. 297 298""" 299maxsize = int() 300""" 301An integer giving the largest supported code point for a Unicode character. The 302value of this depends on the configuration option that specifies whether Unicode 303characters are stored as UCS-2 or UCS-4. 304 305 306""" 307maxunicode = int() 308""" 309A list of :term:`finder` objects that have their :meth:`find_module` 310methods called to see if one of the objects can find the module to be 311imported. The :meth:`find_module` method is called at least with the 312absolute name of the module being imported. If the module to be imported is 313contained in package then the parent package's :attr:`__path__` attribute 314is passed in as a second argument. The method returns :keyword:`None` if 315the module cannot be found, else returns a :term:`loader`. 316 317:data:`sys.meta_path` is searched before any implicit default finders or 318:data:`sys.path`. 319 320See :pep:`302` for the original specification. 321 322 323""" 324meta_path = [None] 325modules = None 326path = [str()] 327""" 328A list of callables that take a path argument to try to create a 329:term:`finder` for the path. If a finder can be created, it is to be 330returned by the callable, else raise :exc:`ImportError`. 331 332Originally specified in :pep:`302`. 333 334 335""" 336path_hooks = [lambda: None] 337""" 338A dictionary acting as a cache for :term:`finder` objects. The keys are 339paths that have been passed to :data:`sys.path_hooks` and the values are 340the finders that are found. If a path is a valid file system path but no 341explicit finder is found on :data:`sys.path_hooks` then :keyword:`None` is 342stored to represent the implicit default finder should be used. If the path 343is not an existing path then :class:`imp.NullImporter` is set. 344 345Originally specified in :pep:`302`. 346 347 348""" 349path_importer_cache = None 350""" 351This string contains a platform identifier that can be used to append 352platform-specific components to :data:`sys.path`, for instance. 353 354For Unix systems, this is the lowercased OS name as returned by ``uname -s`` 355with the first part of the version as returned by ``uname -r`` appended, 356e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*. 357For other systems, the values are: 358 359================ =========================== 360System :data:`platform` value 361================ =========================== 362Windows ``'win32'`` 363Windows/Cygwin ``'cygwin'`` 364Mac OS X ``'darwin'`` 365OS/2 ``'os2'`` 366OS/2 EMX ``'os2emx'`` 367RiscOS ``'riscos'`` 368AtheOS ``'atheos'`` 369================ =========================== 370 371 372""" 373platform = str() 374""" 375A string giving the site-specific directory prefix where the platform 376independent Python files are installed; by default, this is the string 377``'/usr/local'``. This can be set at build time with the ``--prefix`` 378argument to the :program:`configure` script. The main collection of Python 379library modules is installed in the directory ``prefix + '/lib/pythonversion'`` 380while the platform independent header files (all except :file:`pyconfig.h`) are 381stored in ``prefix + '/include/pythonversion'``, where *version* is equal to 382``version[:3]``. 383 384 385""" 386prefix = str() 387ps2 = None 388ps1 = None 389""" 390Bool containing the status of the Python 3.0 warning flag. It's ``True`` 391when Python is started with the -3 option. (This should be considered 392read-only; setting it to a different value doesn't have an effect on 393Python 3.0 warnings.) 394 395""" 396py3kwarning = False 397""" 398If this is true, Python won't try to write ``.pyc`` or ``.pyo`` files on the 399import of source modules. This value is initially set to ``True`` or ``False`` 400depending on the ``-B`` command line option and the ``PYTHONDONTWRITEBYTECODE`` 401environment variable, but you can set it yourself to control bytecode file 402generation. 403 404""" 405dont_write_bytecode = False 406""" 407File objects corresponding to the interpreter's standard input, output and error 408streams. ``stdin`` is used for all interpreter input except for scripts but 409including calls to :func:`input` and :func:`raw_input`. ``stdout`` is used for 410the output of :keyword:`print` and :term:`expression` statements and for the 411prompts of :func:`input` and :func:`raw_input`. The interpreter's own prompts 412and (almost all of) its error messages go to ``stderr``. ``stdout`` and 413``stderr`` needn't be built-in file objects: any object is acceptable as long 414as it has a :meth:`write` method that takes a string argument. (Changing these 415objects doesn't affect the standard I/O streams of processes executed by 416:func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in 417the :mod:`os` module.) 418 419 420""" 421stdin = open("stdin", "rw") 422""" 423File objects corresponding to the interpreter's standard input, output and error 424streams. ``stdin`` is used for all interpreter input except for scripts but 425including calls to :func:`input` and :func:`raw_input`. ``stdout`` is used for 426the output of :keyword:`print` and :term:`expression` statements and for the 427prompts of :func:`input` and :func:`raw_input`. The interpreter's own prompts 428and (almost all of) its error messages go to ``stderr``. ``stdout`` and 429``stderr`` needn't be built-in file objects: any object is acceptable as long 430as it has a :meth:`write` method that takes a string argument. (Changing these 431objects doesn't affect the standard I/O streams of processes executed by 432:func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in 433the :mod:`os` module.) 434 435 436""" 437stdout = open("stdout", "rw") 438""" 439File objects corresponding to the interpreter's standard input, output and error 440streams. ``stdin`` is used for all interpreter input except for scripts but 441including calls to :func:`input` and :func:`raw_input`. ``stdout`` is used for 442the output of :keyword:`print` and :term:`expression` statements and for the 443prompts of :func:`input` and :func:`raw_input`. The interpreter's own prompts 444and (almost all of) its error messages go to ``stderr``. ``stdout`` and 445``stderr`` needn't be built-in file objects: any object is acceptable as long 446as it has a :meth:`write` method that takes a string argument. (Changing these 447objects doesn't affect the standard I/O streams of processes executed by 448:func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in 449the :mod:`os` module.) 450 451 452""" 453stderr = open("stderr", "rw") 454""" 455These objects contain the original values of ``stdin``, ``stderr`` and 456``stdout`` at the start of the program. They are used during finalization, 457and could be useful to print to the actual standard stream no matter if the 458``sys.std*`` object has been redirected. 459 460It can also be used to restore the actual files to known working file objects 461in case they have been overwritten with a broken object. However, the 462preferred way to do this is to explicitly save the previous stream before 463replacing it, and restore the saved object. 464 465 466""" 467__stdout__ = stdout 468__stderr__ = stderr 469__stdin__ = stdin 470""" 471When this variable is set to an integer value, it determines the maximum number 472of levels of traceback information printed when an unhandled exception occurs. 473The default is ``1000``. When set to ``0`` or less, all traceback information 474is suppressed and only the exception type and value are printed. 475 476 477""" 478tracebacklimit = 1000 479""" 480A string containing the version number of the Python interpreter plus additional 481information on the build number and compiler used. This string is displayed 482when the interactive interpreter is started. Do not extract version information 483out of it, rather, use :data:`version_info` and the functions provided by the 484:mod:`platform` module. 485 486 487""" 488version = str() 489""" 490The C API version for this interpreter. Programmers may find this useful when 491debugging version conflicts between Python and extension modules. 492 493""" 494api_version = str() 495""" 496A tuple containing the five components of the version number: *major*, *minor*, 497*micro*, *releaselevel*, and *serial*. All values except *releaselevel* are 498integers; the release level is ``'alpha'``, ``'beta'``, ``'candidate'``, or 499``'final'``. The ``version_info`` value corresponding to the Python version 2.0 500is ``(2, 0, 0, 'final', 0)``. The components can also be accessed by name, 501so ``sys.version_info[0]`` is equivalent to ``sys.version_info.major`` 502and so on. 503 504""" 505version_info = (3, 5, 0, 0, 0) 506""" 507This is an implementation detail of the warnings framework; do not modify this 508value. Refer to the :mod:`warnings` module for more information on the warnings 509framework. 510 511 512""" 513warnoptions = None 514""" 515The version number used to form registry keys on Windows platforms. This is 516stored as string resource 1000 in the Python DLL. The value is normally the 517first three characters of :const:`version`. It is provided in the :mod:`sys` 518module for informational purposes; modifying this value has no effect on the 519registry keys used by Python. Availability: Windows. 520 521""" 522winver = str() 523def call_tracing(func,args): 524 """ 525 Call ``func(*args)``, while tracing is enabled. The tracing state is saved, 526 and restored afterwards. This is intended to be called from a debugger from 527 a checkpoint, to recursively debug some other code. 528 529 530 """ 531 pass 532 533def _clear_type_cache(): 534 """ 535 Clear the internal type cache. The type cache is used to speed up attribute 536 and method lookups. Use the function *only* to drop unnecessary references 537 during reference leak debugging. 538 539 This function should be used for internal and specialized purposes only. 540 541 """ 542 pass 543 544def _current_frames(): 545 """ 546 Return a dictionary mapping each thread's identifier to the topmost stack frame 547 currently active in that thread at the time the function is called. Note that 548 functions in the :mod:`traceback` module can build the call stack given such a 549 frame. 550 551 This is most useful for debugging deadlock: this function does not require the 552 deadlocked threads' cooperation, and such threads' call stacks are frozen for as 553 long as they remain deadlocked. The frame returned for a non-deadlocked thread 554 may bear no relationship to that thread's current activity by the time calling 555 code examines the frame. 556 557 This function should be used for internal and specialized purposes only. 558 559 """ 560 dict() 561 562def displayhook(value): 563 """ 564 If *value* is not ``None``, this function prints it to ``sys.stdout``, and saves 565 it in ``__builtin__._``. 566 567 ``sys.displayhook`` is called on the result of evaluating an :term:`expression` 568 entered in an interactive Python session. The display of these values can be 569 customized by assigning another one-argument function to ``sys.displayhook``. 570 571 572 """ 573 pass 574 575def excepthook(type,value,traceback): 576 """ 577 This function prints out a given traceback and exception to ``sys.stderr``. 578 579 When an exception is raised and uncaught, the interpreter calls 580 ``sys.excepthook`` with three arguments, the exception class, exception 581 instance, and a traceback object. In an interactive session this happens just 582 before control is returned to the prompt; in a Python program this happens just 583 before the program exits. The handling of such top-level exceptions can be 584 customized by assigning another three-argument function to ``sys.excepthook``. 585 586 587 """ 588 pass 589 590def exc_info(): 591 """ 592 This function returns a tuple of three values that give information about the 593 exception that is currently being handled. The information returned is specific 594 both to the current thread and to the current stack frame. If the current stack 595 frame is not handling an exception, the information is taken from the calling 596 stack frame, or its caller, and so on until a stack frame is found that is 597 handling an exception. Here, "handling an exception" is defined as "executing 598 or having executed an except clause." For any stack frame, only information 599 about the most recently handled exception is accessible. 600 601 """ 602 return tuple() 603 604def exc_clear(): 605 """ 606 This function clears all information relating to the current or last exception 607 that occurred in the current thread. After calling this function, 608 :func:`exc_info` will return three ``None`` values until another exception is 609 raised in the current thread or the execution stack returns to a frame where 610 another exception is being handled. 611 612 This function is only needed in only a few obscure situations. These include 613 logging and error handling systems that report information on the last or 614 current exception. This function can also be used to try to free resources and 615 trigger object finalization, though no guarantee is made as to what objects will 616 be freed, if any. 617 618 """ 619 pass 620 621def exit(arg: int): 622 """ 623 Exit from Python. This is implemented by raising the :exc:`SystemExit` 624 exception, so cleanup actions specified by finally clauses of :keyword:`try` 625 statements are honored, and it is possible to intercept the exit attempt at 626 an outer level. 627 628 The optional argument *arg* can be an integer giving the exit status 629 (defaulting to zero), or another type of object. If it is an integer, zero 630 is considered "successful termination" and any nonzero value is considered 631 "abnormal termination" by shells and the like. Most systems require it to be 632 in the range 0-127, and produce undefined results otherwise. Some systems 633 have a convention for assigning specific meanings to specific exit codes, but 634 these are generally underdeveloped; Unix programs generally use 2 for command 635 line syntax errors and 1 for all other kind of errors. If another type of 636 object is passed, ``None`` is equivalent to passing zero, and any other 637 object is printed to :data:`stderr` and results in an exit code of 1. In 638 particular, ``sys.exit("some error message")`` is a quick way to exit a 639 program when an error occurs. 640 641 Since :func:`exit` ultimately "only" raises an exception, it will only exit 642 the process when called from the main thread, and the exception is not 643 intercepted. 644 645 646 """ 647 pass 648 649def getcheckinterval(): 650 """ 651 Return the interpreter's "check interval"; see :func:`setcheckinterval`. 652 653 """ 654 return int() 655 656def getdefaultencoding(): 657 """ 658 Return the name of the current default string encoding used by the Unicode 659 implementation. 660 661 """ 662 return str() 663 664def getdlopenflags(): 665 """ 666 Return the current value of the flags that are used for :cfunc:`dlopen` calls. 667 The flag constants are defined in the :mod:`dl` and :mod:`DLFCN` modules. 668 Availability: Unix. 669 670 """ 671 return str() 672 673def getfilesystemencoding(): 674 """ 675 Return the name of the encoding used to convert Unicode filenames into system 676 file names, or ``None`` if the system default encoding is used. The result value 677 depends on the operating system: 678 679 * On Mac OS X, the encoding is ``'utf-8'``. 680 681 * On Unix, the encoding is the user's preference according to the result of 682 nl_langinfo(CODESET), or ``None`` if the ``nl_langinfo(CODESET)`` 683 failed. 684 685 * On Windows NT+, file names are Unicode natively, so no conversion is 686 performed. :func:`getfilesystemencoding` still returns ``'mbcs'``, as 687 this is the encoding that applications should use when they explicitly 688 want to convert Unicode strings to byte strings that are equivalent when 689 used as file names. 690 691 * On Windows 9x, the encoding is ``'mbcs'``. 692 693 """ 694 return "utf-8" 695 696def getrefcount(object): 697 """ 698 Return the reference count of the *object*. The count returned is generally one 699 higher than you might expect, because it includes the (temporary) reference as 700 an argument to :func:`getrefcount`. 701 702 703 """ 704 return 0 705 706def getrecursionlimit(): 707 """ 708 Return the current value of the recursion limit, the maximum depth of the Python 709 interpreter stack. This limit prevents infinite recursion from causing an 710 overflow of the C stack and crashing Python. It can be set by 711 :func:`setrecursionlimit`. 712 713 714 """ 715 return 1000 716 717def getsizeof(object,default): 718 """ 719 Return the size of an object in bytes. The object can be any type of 720 object. All built-in objects will return correct results, but this 721 does not have to hold true for third-party extensions as it is implementation 722 specific. 723 724 If given, *default* will be returned if the object does not provide means to 725 retrieve the size. Otherwise a :exc:`TypeError` will be raised. 726 727 :func:`getsizeof` calls the object's ``__sizeof__`` method and adds an 728 additional garbage collector overhead if the object is managed by the garbage 729 collector. 730 731 """ 732 return 0 733 734def _getframe(depth: int): 735 """ 736 Return a frame object from the call stack. If optional integer *depth* is 737 given, return the frame object that many calls below the top of the stack. If 738 that is deeper than the call stack, :exc:`ValueError` is raised. The default 739 for *depth* is zero, returning the frame at the top of the call stack. 740 741 """ 742 pass 743 744def getprofile(): 745 pass 746 747def gettrace(): 748 pass 749 750def getwindowsversion(): 751 """ 752 Return a named tuple describing the Windows version 753 currently running. The named elements are *major*, *minor*, 754 *build*, *platform*, *service_pack*, *service_pack_minor*, 755 *service_pack_major*, *suite_mask*, and *product_type*. 756 *service_pack* contains a string while all other values are 757 integers. The components can also be accessed by name, so 758 ``sys.getwindowsversion()[0]`` is equivalent to 759 ``sys.getwindowsversion().major``. For compatibility with prior 760 versions, only the first 5 elements are retrievable by indexing. 761 762 *platform* may be one of the following values: 763 764 +-----------------------------------------+-------------------------+ 765 | Constant | Platform | 766 +=========================================+=========================+ 767 | :const:`0 (VER_PLATFORM_WIN32s)` | Win32s on Windows 3.1 | 768 +-----------------------------------------+-------------------------+ 769 | :const:`1 (VER_PLATFORM_WIN32_WINDOWS)` | Windows 95/98/ME | 770 +-----------------------------------------+-------------------------+ 771 | :const:`2 (VER_PLATFORM_WIN32_NT)` | Windows NT/2000/XP/x64 | 772 +-----------------------------------------+-------------------------+ 773 | :const:`3 (VER_PLATFORM_WIN32_CE)` | Windows CE | 774 +-----------------------------------------+-------------------------+ 775 776 *product_type* may be one of the following values: 777 778 +---------------------------------------+---------------------------------+ 779 | Constant | Meaning | 780 +=======================================+=================================+ 781 | :const:`1 (VER_NT_WORKSTATION)` | The system is a workstation. | 782 +---------------------------------------+---------------------------------+ 783 | :const:`2 (VER_NT_DOMAIN_CONTROLLER)` | The system is a domain | 784 | | controller. | 785 +---------------------------------------+---------------------------------+ 786 | :const:`3 (VER_NT_SERVER)` | The system is a server, but not | 787 | | a domain controller. | 788 +---------------------------------------+---------------------------------+ 789 790 791 This function wraps the Win32 :cfunc:`GetVersionEx` function; see the 792 Microsoft documentation on :cfunc:`OSVERSIONINFOEX` for more information 793 about these fields. 794 795 Availability: Windows. 796 797 """ 798 return (0, 0) 799 800def setcheckinterval(interval: int): 801 """ 802 Set the interpreter's "check interval". This integer value determines how often 803 the interpreter checks for periodic things such as thread switches and signal 804 handlers. The default is ``100``, meaning the check is performed every 100 805 Python virtual instructions. Setting it to a larger value may increase 806 performance for programs using threads. Setting it to a value ``<=`` 0 checks 807 every virtual instruction, maximizing responsiveness as well as overhead. 808 809 810 """ 811 pass 812 813def setdefaultencoding(name): 814 """ 815 Set the current default string encoding used by the Unicode implementation. If 816 *name* does not match any available encoding, :exc:`LookupError` is raised. 817 This function is only intended to be used by the :mod:`site` module 818 implementation and, where needed, by :mod:`sitecustomize`. Once used by the 819 :mod:`site` module, it is removed from the :mod:`sys` module's namespace. 820 821 .. mod:`site` is not imported if the :option:`-S` option is passed 822 to the interpreter, in which case this function will remain available. 823 824 """ 825 pass 826 827def setdlopenflags(n): 828 """ 829 Set the flags used by the interpreter for :cfunc:`dlopen` calls, such as when 830 the interpreter loads extension modules. Among other things, this will enable a 831 lazy resolving of symbols when importing a module, if called as 832 ``sys.setdlopenflags(0)``. To share symbols across extension modules, call as 833 ``sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL)``. Symbolic names for the 834 flag modules can be either found in the :mod:`dl` module, or in the :mod:`DLFCN` 835 module. If :mod:`DLFCN` is not available, it can be generated from 836 :file:`/usr/include/dlfcn.h` using the :program:`h2py` script. Availability: 837 Unix. 838 839 """ 840 pass 841 842def setprofile(profilefunc): 843 pass 844 845def setrecursionlimit(limit): 846 """ 847 Set the maximum depth of the Python interpreter stack to *limit*. This limit 848 prevents infinite recursion from causing an overflow of the C stack and crashing 849 Python. 850 851 The highest possible limit is platform-dependent. A user may need to set the 852 limit higher when she has a program that requires deep recursion and a platform 853 that supports a higher limit. This should be done with care, because a too-high 854 limit can lead to a crash. 855 856 857 """ 858 pass 859 860def settrace(tracefunc): 861 """ 862 """ 863 pass 864 865def settscdump(on_flag): 866 """ 867 Activate dumping of VM measurements using the Pentium timestamp counter, if 868 *on_flag* is true. Deactivate these dumps if *on_flag* is off. The function is 869 available only if Python was compiled with ``--with-tsc``. To understand 870 the output of this dump, read :file:`Python/ceval.c` in the Python sources. 871 872 """ 873 pass 874 875