summaryrefslogtreecommitdiffstats
path: root/Doc/library/sys.rst
Commit message (Collapse)AuthorAgeFilesLines
* Docs: Fix backtick errors found by sphinx-lint (#97998)Hugo van Kemenade2022-10-071-3/+3
| | | Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* gh-96512: Update int_max_str docs to say 3.11 (#96942)Gregory P. Smith2022-09-191-4/+4
| | | | It was unknown if it'd be before 3.11.0 when creating the original changes. It's in 3.11rc2, so 3.11 it is.
* gh-95778: Fix `sys.set_int_max_str_digits()` parameter name (#96798)Alex Waygood2022-09-131-1/+1
| | | Discovered in https://github.com/python/typeshed/pull/8733
* gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)Gregory P. Smith2022-09-021-13/+44
| | | | | | | | | | | | | | | | Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds. This PR comes fresh from a pile of work done in our private PSRT security response team repo. Signed-off-by: Christian Heimes [Red Hat] <christian@python.org> Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org> Reviews via the private PSRT repo via many others (see the NEWS entry in the PR). <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#). Much of that text wound up in the Issue. Backports PRs already exist. See the issue for links.
* gh-91838: Use HTTPS links in docs for resources which redirect to HTTPS ↵Serhiy Storchaka2022-08-041-1/+1
| | | | | | | | | | (GH-95527) If an HTTP link is redirected to a same looking HTTPS link, the latter can be used directly without changes in readability and behavior. It protects from a men-in-the-middle attack. This change does not affect Python examples.
* bpo-45445: Revert "bpo-45445: Fail if an invalid X-option is provided in the ↵Pablo Galindo Salgado2022-07-311-2/+2
| | | | command line (GH-28823)" (#94745)
* gh-95415: Make availability directive consistent (GH-95416)Christian Heimes2022-07-291-1/+1
|
* gh-95174: Add pthread stubs for WASI (GH-95234)Christian Heimes2022-07-271-0/+2
| | | Co-authored-by: Brett Cannon <brett@python.org>
* gh-91348: Restore frame argument to sys._getframe audit event (GH-94928)Steve Dower2022-07-171-1/+1
|
* gh-91181: drop support for bytes on sys.path (GH-31934)Thomas Grainger2022-07-171-1/+1
| | | | | | Support for bytes broke sometime between Python 3.2 and 3.6 and has been broken ever since. Trying to bring back supports is surprisingly difficult in the face of -b and checking for keys in sys.path_importer_cache. Since the support was broken for so long, trying to overcome the difficulty of bringing back the support has been deemed not worth it. Co-authored-by: Eryk Sun <eryksun@gmail.com> Co-authored-by: Brett Cannon <brett@python.org>
* bpo-30535: [doc] state that sys.meta_path is not empty by default (GH-94098)Irit Katriel2022-06-211-1/+2
| | | Co-authored-by: Windson yang <wiwindson@outlook.com>
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-051-8/+16
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* gh-84461: Add sys._emscripten_info, improve docs and build (gh-91781)Christian Heimes2022-04-231-0/+29
|
* gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531)Irit Katriel2022-04-151-12/+5
|
* bpo-40280: WASM docs and smaller browser builds (GH-32412)Christian Heimes2022-04-101-0/+2
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-31582: Created a new documentation section describing sys.path ↵Russel Webber2022-03-231-3/+4
| | | | initialization (GH-31082)
* bpo-6634: [doc] clarify that sys.exit() does not always exit the interpreter ↵vidhya2022-03-031-5/+3
| | | | (GH-31639)
* bpo-46328: Add sys.exception() (GH-30514)Irit Katriel2022-01-131-15/+30
|
* bpo-45711: Change exc_info related APIs to derive type and traceback from ↵Irit Katriel2021-11-301-3/+8
| | | | the exception instance (GH-29780)
* bpo-45788: Link sys.prefix doc to 'Installation paths' (#29606)Terry Jan Reedy2021-11-181-6/+3
| | | ... To the Installation paths section of the sysconfig doc.
* bpo-45445: Fail if an invalid X-option is provided in the command line ↵Pablo Galindo Salgado2021-10-131-2/+2
| | | | (GH-28823)
* bpo-45353: Remind sys.modules users to copy when iterating. (GH-28842)Gregory P. Smith2021-10-091-1/+5
| | | | | | | | This is true of all dictionaries in Python, but this one tends to catch people off guard as they don't realize when sys.modules might change out from underneath them as a hidden side effect of their code. Copying it first avoids the RuntimeError. An example when this happens in single threaded code are codecs being loaded which are an implicit time of use import that most need not think about.
* bpo-43284: Update platform.win32_ver to use _syscmd_ver instead of ↵Shreyan Avigyan2021-04-221-1/+6
| | | | | | | sys.getwindowsversion() (GH-25500) The sys module uses the kernel32.dll version number, which can vary from the "actual" Windows version. Since the best option for getting the version is WMI (which is expensive), we switch back to launching cmd.exe (which is also expensive, but a lot less code on our part). sys.getwindowsversion() is not updated to avoid launching executables from that module.
* bpo-43475: Fix worst case collision behavior for NaN instances (GH-25493)Raymond Hettinger2021-04-221-1/+1
|
* bpo-43472: Ensure PyInterpreterState_New audit events are raised when called ↵Steve Dower2021-04-211-2/+2
| | | | through _xxsubinterpreters module (GH-25506)
* bpo-43774: Add more links to configure options (GH-25363)Victor Stinner2021-04-121-2/+3
|
* bpo-43774: Document configure options (GH-25283)Victor Stinner2021-04-081-2/+2
| | | | | | Add Doc/using/configure.rst documentation to document configure, preprocessor, compiler and linker options. Add a new section about the "Python debug build".
* bpo-42955: Remove sub-packages from sys.stdlib_module_names (GH-24353)Victor Stinner2021-01-271-3/+4
|
* bpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)Victor Stinner2021-01-251-19/+19
| | | | * Rename _Py_module_names to _Py_stdlib_module_names. * Rename Python/module_names.h to Python/stdlib_module_names.h.
* bpo-42955: Fix sys.module_names doc (GH-24329)Victor Stinner2021-01-251-1/+1
| | | Replace versionchanged markup with versionadded.
* bpo-42955: Add sys.modules_names (GH-24238)Victor Stinner2021-01-251-1/+21
| | | | Add sys.module_names, containing the list of the standard library module names.
* bpo-42236: Enhance init and encoding documentation (GH-23109)Victor Stinner2020-11-021-17/+25
| | | | | | | | | | | | | | | | | | | | | Enhance the documentation of the Python startup, filesystem encoding and error handling, locale encoding. Add a new "Python UTF-8 Mode" section. * Add "locale encoding" and "filesystem encoding and error handler" to the glossary * Remove documentation from Include/cpython/initconfig.h: move it to Doc/c-api/init_config.rst. * Doc/c-api/init_config.rst: * Document command line options and environment variables * Document default values. * Add a new "Python UTF-8 Mode" section in Doc/library/os.rst. * Add warnings to Py_DecodeLocale() and Py_EncodeLocale() docs. * Document how Python selects the filesystem encoding and error handler at a single place: PyConfig.filesystem_encoding and PyConfig.filesystem_errors. * PyConfig: move orig_argv member at the right place.
* bpo-41435: Add sys._current_exceptions() function (GH-21689)Julien Danjou2020-11-021-0/+12
| | | | | | This adds a new function named sys._current_exceptions() which is equivalent ot sys._current_frames() except that it returns the exceptions currently handled by other threads. It is equivalent to calling sys.exc_info() for each running thread.
* bpo-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086)Victor Stinner2020-11-011-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the nl_langinfo(CODESET) function returns an empty string, Python now uses UTF-8 as the filesystem encoding. In May 2010 (commit b744ba1d14c5487576c95d0311e357b707600b47), I modified Python to log a warning and use UTF-8 as the filesystem encoding (instead of None) if nl_langinfo(CODESET) returns an empty string. In August 2020 (commit 94908bbc1503df830d1d615e7b57744ae1b41079), I modified Python startup to fail with a fatal error and a specific error message if nl_langinfo(CODESET) returns an empty string. The intent was to prevent guessing the encoding and also investigate user configuration where this case happens. In 10 years (2010 to 2020), I saw zero user report about the error message related to nl_langinfo(CODESET) returning an empty string. Today, UTF-8 became the defacto standard and it's safe to make the assumption that the user expects UTF-8. For example, nl_langinfo(CODESET) can return an empty string on macOS if the LC_CTYPE locale is not supported, and UTF-8 is the default encoding on macOS. While this change is likely to not affect anyone in practice, it should make UTF-8 lover happy ;-) Rewrite also the documentation explaining how Python selects the filesystem encoding and error handler.
* bpo-41192: Clarify the sys module's description of the auditing feature ↵Andrew Kuchling2020-10-201-10/+25
| | | | | | (GH-22768) Co-authored-by: Éric Araujo <merwok@netwok.org>
* Revert "Fix all Python Cookbook links (#22205)" (GH-22424)Andre Delfino2020-09-271-1/+1
| | | This commit reverts commit ac0333e1e117b7f61ed7ef1dbcdb6e515ada603b as the original links are working again and they provide extended features such as comments and alternative versions.
* Fix all Python Cookbook links (#22205)Andre Delfino2020-09-151-1/+1
|
* bpo-23427: Add sys.orig_argv attribute (GH-20729)Victor Stinner2020-06-291-0/+12
| | | | | | | Add sys.orig_argv attribute: the list of the original command line arguments passed to the Python executable. Rename also PyConfig._orig_argv to PyConfig.orig_argv and document it.
* bpo-1294959: Try to clarify the meaning of platlibdir (GH-20332)Michał Górny2020-05-281-3/+4
| | | | | | | | Try to make the meaning of platlibdir clear. The previous wording could be misinterpreted to suggest that it will be used to find all shared libraries on the system, and not just Python extensions. Furthermore, it was unclear whether it affects third-party (site-packages) extensions or not. The new wording tries to make its dual purpose clear, and provide the additional example of extensions in site-packages.
* bpo-1294959: Add sys.platlibdir attribute (GH-18381)Victor Stinner2020-03-101-0/+21
| | | | | | | | | | | | | Add --with-platlibdir option to the configure script: name of the platform-specific library directory, stored in the new sys.platlitdir attribute. It is used to build the path of platform-specific dynamic libraries and the path of the standard library. It is equal to "lib" on most platforms. On Fedora and SuSE, it is equal to "lib64" on 64-bit systems. Co-Authored-By: Jan Matějek <jmatejek@suse.com> Co-Authored-By: Matěj Cepl <mcepl@cepl.eu> Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
* Doc: sys.__unraisablehook__ and bytearray.hex separators are new in 3.8 ↵Saiyang Gou2020-02-081-0/+2
| | | | | | | | (GH-17884) Minor fix in documentation: - `sys.__unraisablehook__` is new in version 3.8 - Optional `sep` and `bytes_per_sep` parameters for `bytearray.hex` is also supported in Python 3.8 (just like `bytes.hex`)
* bpo-39429: Add a new "Python Development Mode" doc page (GH-18132)Victor Stinner2020-01-241-7/+8
|
* bpo-39310: Add math.ulp(x) (GH-17965)Victor Stinner2020-01-131-8/+14
| | | | Add math.ulp(): return the value of the least significant bit of a float.
* bpo-13601: always use line-buffering for sys.stderr (GH-17646)Jendrik Seipp2020-01-011-3/+9
|
* bpo-38920: Add audit hooks for when sys.excepthook and sys.unraisable hooks ↵Steve Dower2019-11-281-1/+22
| | | | | are invoked (GH-17392) Also fixes some potential segfaults in unraisable hook handling.
* bpo-38892: Improve docs for audit event (GH-17361)Terry Jan Reedy2019-11-261-3/+3
|
* bpo-38738: Fix formatting of True and False. (GH-17083)Serhiy Storchaka2019-11-121-1/+1
| | | | | | | | | * "Return true/false" is replaced with "Return ``True``/``False``" if the function actually returns a bool. * Fixed formatting of some True and False literals (now in monospace). * Replaced "True/False" with "true/false" if it can be not only bool. * Replaced some 1/0 with True/False if it corresponds the code. * "Returns <bool>" is replaced with "Return <bool>".
* bpo-38434: Fixes some audit event documentation (GH-16932)Steve Dower2019-10-261-8/+11
|
* bpo-37937: Mention frame.f_trace in sys.settrace docs (GH-15439)Ram Rachum2019-09-201-0/+11
| | | | | | Mention frame.f_trace in sys.settrace docs, as well as the fact you still need to call `sys.settrace` to enable the tracing machinery before setting `frame.f_trace` will have any effect.
* bpo-36270: Doc: add link to traceback object reference (GH-13119)Björn Meier2019-09-111-1/+1
|