| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1348,3 +1348,67 @@ Tracebacks | |||
| 1348 | 1348 | ||
| 1349 | 1349 | This function returns ``0`` on success, and returns ``-1`` with an | |
| 1350 | 1350 | exception set on failure. | |
| 1351 | + | ||
| 1352 | + .. c:function:: const char* PyUnstable_DumpTraceback(int fd, PyThreadState *tstate) | ||
| 1353 | + | ||
| 1354 | + Write a trace of the Python stack in *tstate* into the file *fd*. The format | ||
| 1355 | + looks like:: | ||
| 1356 | + | ||
| 1357 | + Traceback (most recent call first): | ||
| 1358 | + File "xxx", line xxx in <xxx> | ||
| 1359 | + File "xxx", line xxx in <xxx> | ||
| 1360 | + ... | ||
| 1361 | + File "xxx", line xxx in <xxx> | ||
| 1362 | + | ||
| 1363 | + This function is meant to debug situations such as segfaults, fatal errors, | ||
| 1364 | + and similar. The file and function names it outputs are encoded to ASCII with | ||
| 1365 | + backslashreplace and truncated to 500 characters. It writes only the first | ||
| 1366 | + 100 frames; further frames are truncated with the line ``...``. | ||
| 1367 | + | ||
| 1368 | + This function will return ``NULL`` on success, or an error message on error. | ||
| 1369 | + | ||
| 1370 | + This function is intended for use in crash scenarios such as signal handlers | ||
| 1371 | + for SIGSEGV, where the interpreter may be in an inconsistent state. Given | ||
| 1372 | + that it reads interpreter data structures that may be partially modified, the | ||
| 1373 | + function might produce incomplete output or it may even crash itself. | ||
| 1374 | + | ||
| 1375 | + The caller does not need to hold an :term:`attached thread state`, nor does | ||
| 1376 | + *tstate* need to be attached. | ||
| 1377 | + | ||
| 1378 | + .. versionadded:: next | ||
| 1379 | + | ||
| 1380 | + .. c:function:: const char* PyUnstable_DumpTracebackThreads(int fd, PyInterpreterState *interp, PyThreadState *current_tstate, Py_ssize_t max_threads) | ||
| 1381 | + | ||
| 1382 | + Write the traces of all Python threads in *interp* into the file *fd*. | ||
| 1383 | + | ||
| 1384 | + If *interp* is ``NULL`` then this function will try to identify the current | ||
| 1385 | + interpreter using thread-specific storage. If it cannot, it will return an | ||
| 1386 | + error. | ||
| 1387 | + | ||
| 1388 | + If *current_tstate* is not ``NULL`` then it will be used to identify what the | ||
| 1389 | + current thread is in the written output. If it is ``NULL`` then this function | ||
| 1390 | + will identify the current thread using thread-specific storage. It is not an | ||
| 1391 | + error if the function is unable to get the current Python thread state. | ||
| 1392 | + | ||
| 1393 | + This function will return ``NULL`` on success, or an error message on error. | ||
| 1394 | + | ||
| 1395 | + This function is meant to debug debug situations such as segfaults, fatal | ||
| 1396 | + errors, and similar. It calls :c:func:`PyUnstable_DumpTraceback` for each | ||
| 1397 | + thread. It only writes the tracebacks of the first *max_threads* threads, | ||
| 1398 | + further output is truncated with the line ``...``. If *max_threads* is 0, the | ||
| 1399 | + function will use a default value of 100 for the argument. | ||
| 1400 | + | ||
| 1401 | + This function is intended for use in crash scenarios such as signal handlers | ||
| 1402 | + for SIGSEGV, where the interpreter may be in an inconsistent state. Given | ||
| 1403 | + that it reads interpreter data structures that may be partially modified, the | ||
| 1404 | + function might produce incomplete output or it may even crash itself. | ||
| 1405 | + | ||
| 1406 | + The caller does not need to hold an :term:`attached thread state`, nor does | ||
| 1407 | + *current_tstate* need to be attached. | ||
| 1408 | + | ||
| 1409 | + .. warning:: | ||
| 1410 | + On the :term:`free-threaded build`, this function is not thread-safe. If | ||
| 1411 | + another thread deletes its :term:`thread state` while this function is being | ||
| 1412 | + called, the process will likely crash. | ||
| 1413 | + | ||
| 1414 | + .. versionadded:: next | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,11 @@ Pending removal in Python 3.17 | |||
| 37 | 37 | is deprecated and scheduled for removal in Python 3.17. | |
| 38 | 38 | (Contributed by Stan Ulbrych in :gh:`136702`.) | |
| 39 | 39 | ||
| 40 | + * :mod:`webbrowser`: | ||
| 41 | + | ||
| 42 | + - :class:`!webbrowser.MacOSXOSAScript` is deprecated in favour of | ||
| 43 | + :class:`!webbrowser.MacOS`. (:gh:`137586`) | ||
| 44 | + | ||
| 40 | 45 | * :mod:`typing`: | |
| 41 | 46 | ||
| 42 | 47 | - Before Python 3.14, old-style unions were implemented using the private class | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,3 +31,12 @@ Pending removal in Python 3.19 | |||
| 31 | 31 | * :meth:`http.cookies.BaseCookie.js_output` is deprecated and will be | |
| 32 | 32 | removed in Python 3.19. | |
| 33 | 33 | ||
| 34 | + * :mod:`imaplib`: | ||
| 35 | + | ||
| 36 | + * Altering :attr:`IMAP4.file <imaplib.IMAP4.file>` is now deprecated | ||
| 37 | + and slated for removal in Python 3.19. This property is now unused | ||
| 38 | + and changing its value does not automatically close the current file. | ||
| 39 | + | ||
| 40 | + Before Python 3.14, this property was used to implement the corresponding | ||
| 41 | + ``read()`` and ``readline()`` methods for :class:`~imaplib.IMAP4` but this | ||
| 42 | + is no longer the case since then. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1107,13 +1107,13 @@ are always available. They are listed here in alphabetical order. | |||
| 1107 | 1107 | *classinfo* can be a :ref:`types-union`. | |
| 1108 | 1108 | ||
| 1109 | 1109 | ||
| 1110 | - .. function:: issubclass(class, classinfo, /) | ||
| 1110 | + .. function:: issubclass(cls, classinfo, /) | ||
| 1111 | 1111 | ||
| 1112 | - Return ``True`` if *class* is a subclass (direct, indirect, or :term:`virtual | ||
| 1112 | + Return ``True`` if *cls* is a subclass (direct, indirect, or :term:`virtual | ||
| 1113 | 1113 | <abstract base class>`) of *classinfo*. A | |
| 1114 | 1114 | class is considered a subclass of itself. *classinfo* may be a tuple of class | |
| 1115 | 1115 | objects (or recursively, other such tuples) | |
| 1116 | - or a :ref:`types-union`, in which case return ``True`` if *class* is a | ||
| 1116 | + or a :ref:`types-union`, in which case return ``True`` if *cls* is a | ||
| 1117 | 1117 | subclass of any entry in *classinfo*. In any other case, a :exc:`TypeError` | |
| 1118 | 1118 | exception is raised. | |
| 1119 | 1119 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -695,6 +695,16 @@ The following attributes are defined on instances of :class:`IMAP4`: | |||
| 695 | 695 | .. versionadded:: 3.5 | |
| 696 | 696 | ||
| 697 | 697 | ||
| 698 | + .. property:: IMAP4.file | ||
| 699 | + | ||
| 700 | + Internal :class:`~io.BufferedReader` associated with the underlying socket. | ||
| 701 | + This property is documented for legacy purposes but not part of the public | ||
| 702 | + interface. The caller is responsible to ensure that the current file is | ||
| 703 | + closed before changing it. | ||
| 704 | + | ||
| 705 | + .. deprecated-removed:: next 3.19 | ||
| 706 | + | ||
| 707 | + | ||
| 698 | 708 | .. _imap4-example: | |
| 699 | 709 | ||
| 700 | 710 | IMAP4 Example | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -172,13 +172,15 @@ for the controller classes, all defined in this module. | |||
| 172 | 172 | +------------------------+-----------------------------------------+-------+ | |
| 173 | 173 | | ``'windows-default'`` | ``WindowsDefault`` | \(2) | | |
| 174 | 174 | +------------------------+-----------------------------------------+-------+ | |
| 175 | - | ``'macosx'`` | ``MacOSXOSAScript('default')`` | \(3) | | ||
| 175 | + | ``'macos'`` | ``MacOS('default')`` | \(3) | | ||
| 176 | 176 | +------------------------+-----------------------------------------+-------+ | |
| 177 | - | ``'safari'`` | ``MacOSXOSAScript('safari')`` | \(3) | | ||
| 177 | + | ``'safari'`` | ``MacOS('safari')`` | \(3) | | ||
| 178 | 178 | +------------------------+-----------------------------------------+-------+ | |
| 179 | - | ``'google-chrome'`` | ``Chrome('google-chrome')`` | | | ||
| 179 | + | ``'chrome'`` | ``MacOS('google chrome')`` | \(3) | | ||
| 180 | + +------------------------+-----------------------------------------+-------+ | ||
| 181 | + | ``'firefox'`` | ``MacOS('firefox')`` | \(3) | | ||
| 180 | 182 | +------------------------+-----------------------------------------+-------+ | |
| 181 | - | ``'chrome'`` | ``Chrome('chrome')`` | | | ||
| 183 | + | ``'google-chrome'`` | ``Chrome('google-chrome')`` | | | ||
| 182 | 184 | +------------------------+-----------------------------------------+-------+ | |
| 183 | 185 | | ``'chromium'`` | ``Chromium('chromium')`` | | | |
| 184 | 186 | +------------------------+-----------------------------------------+-------+ | |
@@ -221,6 +223,17 @@ Notes: | |||
| 221 | 223 | .. versionchanged:: 3.13 | |
| 222 | 224 | Support for iOS has been added. | |
| 223 | 225 | ||
| 226 | + .. versionadded:: next | ||
| 227 | + :class:`!MacOS` has been added as a replacement for :class:`!MacOSXOSAScript`, | ||
| 228 | + opening browsers via :program:`/usr/bin/open` instead of :program:`osascript`. | ||
| 229 | + | ||
| 230 | + .. deprecated-removed:: next 3.17 | ||
| 231 | + :class:`!MacOSXOSAScript` is deprecated in favour of :class:`!MacOS`. | ||
| 232 | + Using :program:`/usr/bin/open` instead of :program:`osascript` is a | ||
| 233 | + security and usability improvement: :program:`osascript` may be blocked | ||
| 234 | + on managed systems due to its abuse potential as a general-purpose | ||
| 235 | + scripting interpreter. | ||
| 236 | + | ||
| 224 | 237 | Here are some simple examples:: | |
| 225 | 238 | ||
| 226 | 239 | url = 'https://docs.python.org/' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,19 @@ This module also defines utility functions. | |||
| 54 | 54 | "!", "?", and "=" are forbidden. | |
| 55 | 55 | The name cannot start with a digit or a character like "-", ".", and "·". | |
| 56 | 56 | ||
| 57 | - ..versionadded:: next | ||
| 57 | + .. versionadded:: next | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + .. function:: is_valid_text(data) | ||
| 61 | + | ||
| 62 | + Return ``True`` if the string is a sequence of legal XML 1.0 characters, | ||
| 63 | + ``False`` otherwise. | ||
| 64 | + | ||
| 65 | + Almost all characters are permitted in XML 1.0 documents, except C0 control | ||
| 66 | + characters (excluding TAB, CR and LF), surrogate characters and special | ||
| 67 | + Unicode characters U+FFFE and U+FFFF. | ||
| 68 | + | ||
| 69 | + .. versionadded:: next | ||
| 58 | 70 | ||
| 59 | 71 | ||
| 60 | 72 | .. _xml-security: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -788,15 +788,14 @@ also be used to improve performance. | |||
| 788 | 788 | pointers to ``BASECFLAGS``: | |
| 789 | 789 | ||
| 790 | 790 | - ``-fno-omit-frame-pointer`` and/or ``-mno-omit-leaf-frame-pointer`` | |
| 791 | - are added when the compiler supports them, | ||
| 791 | + are added when the compiler supports them. | ||
| 792 | 792 | - ``-marm`` and/or ``-mno-thumb`` is added on 32-bit ARM when supported, | |
| 793 | - - on s390x platforms, when supported, ``-mbackchain`` is added *instead* | ||
| 794 | - of the above frame pointer flags | ||
| 793 | + - on s390x platforms, when supported, ``-mbackchain`` is added *instead*. | ||
| 794 | + of the above frame pointer flags. | ||
| 795 | 795 | ||
| 796 | 796 | Frame pointers enable profilers, debuggers, and system tracing tools | |
| 797 | 797 | (``perf``, ``eBPF``, ``dtrace``, ``gdb``) to walk the C call stack | |
| 798 | - without DWARF metadata. | ||
| 799 | - The flags propagate to third-party C | ||
| 798 | + without DWARF metadata. The flags propagate to third-party C | ||
| 800 | 799 | extensions through :mod:`sysconfig`. On compilers that do not | |
| 801 | 800 | understand them, the build silently skips them. | |
| 802 | 801 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,6 +81,7 @@ Summary -- Release highlights | |||
| 81 | 81 | <whatsnew315-unpacking-in-comprehensions>` | |
| 82 | 82 | * :pep:`686`: :ref:`Python now uses UTF-8 as the default encoding | |
| 83 | 83 | <whatsnew315-utf8-default>` | |
| 84 | + * :pep:`829`: :ref:`Package startup configuration files <whatsnew315-startup-files>` | ||
| 84 | 85 | * :pep:`728`: :ref:`TypedDict with typed extra items <whatsnew315-typeddict>` | |
| 85 | 86 | * :pep:`747`: :ref:`Annotating type forms with TypeForm | |
| 86 | 87 | <whatsnew315-typeform>` | |
@@ -94,7 +95,6 @@ Summary -- Release highlights | |||
| 94 | 95 | * :ref:`Improved error messages <whatsnew315-improved-error-messages>` | |
| 95 | 96 | * :ref:`The official Windows 64-bit binaries now use the tail-calling interpreter | |
| 96 | 97 | <whatsnew315-windows-tail-calling-interpreter>` | |
| 97 | - * :pep:`829`: Package Startup Configuration Files | ||
| 98 | 98 | ||
| 99 | 99 | New features | |
| 100 | 100 | ============ | |
@@ -452,6 +452,31 @@ agen() for x in a)``. | |||
| 452 | 452 | ||
| 453 | 453 | (Contributed by Adam Hartz in :gh:`143055`.) | |
| 454 | 454 | ||
| 455 | + .. _whatsnew315-startup-files: | ||
| 456 | + | ||
| 457 | + :pep:`829`: Package startup configuration files | ||
| 458 | + ----------------------------------------------- | ||
| 459 | + | ||
| 460 | + Loaded by the :mod:`site` module when ``-S`` is not given, :ref:`.pth files <site-pth-files>` | ||
| 461 | + can contain lines that both extend :data:`sys.path` and execute arbitrary code | ||
| 462 | + when the line starts with ``import`` (followed by a space or tab). The latter | ||
| 463 | + functionality can be problematic, since it is difficult to know exactly what | ||
| 464 | + gets executed when Python starts up. | ||
| 465 | + | ||
| 466 | + As a step towards improving the ability to audit pre-start executable code, | ||
| 467 | + Python 3.15 introduces :ref:`.start files <site-start-files>` which contain entry point | ||
| 468 | + specifications of the form ``pkg.mod:callable`` where ``pkg.mod`` is the | ||
| 469 | + import path to the given callable. When Python starts up, the callable is | ||
| 470 | + located and called with no arguments. | ||
| 471 | + | ||
| 472 | + ``import`` lines in :file:`.pth` files are silently deprecated. When a | ||
| 473 | + matching :file:`.start` file is found, ``import`` lines in :file:`.pth` files | ||
| 474 | + are ignored. There is no change to :data:`sys.path` extension lines in | ||
| 475 | + :file:`.pth` files. | ||
| 476 | + | ||
| 477 | + (Contributed by Barry Warsaw in :gh:`148641`.) | ||
| 478 | + | ||
| 479 | + | ||
| 455 | 480 | .. _whatsnew315-abi3t: | |
| 456 | 481 | ||
| 457 | 482 | :pep:`803` -- Stable ABI for Free-Threaded Builds | |
@@ -627,6 +652,11 @@ Other language changes | |||
| 627 | 652 | ||
| 628 | 653 | (Contributed by Adam Turner in :gh:`133711`; PEP 686 written by Inada Naoki.) | |
| 629 | 654 | ||
| 655 | + * The interpreter help (such as ``python --help``) is now in color. | ||
| 656 | + This can be controlled by :ref:`environment variables | ||
| 657 | + <using-on-controlling-color>`. | ||
| 658 | + (Contributed by Hugo van Kemenade in :gh:`148766`.) | ||
| 659 | + | ||
| 630 | 660 | * Unraisable exceptions are now highlighted with color by default. This can be | |
| 631 | 661 | controlled by :ref:`environment variables <using-on-controlling-color>`. | |
| 632 | 662 | (Contributed by Peter Bierma in :gh:`134170`.) | |
@@ -1663,13 +1693,31 @@ wave | |||
| 1663 | 1693 | (Contributed by Lionel Koenig and Michiel W. Beijen in :gh:`60729`.) | |
| 1664 | 1694 | ||
| 1665 | 1695 | ||
| 1696 | + webbrowser | ||
| 1697 | + ---------- | ||
| 1698 | + | ||
| 1699 | + * On macOS, the new :class:`!webbrowser.MacOS` class opens URLs via | ||
| 1700 | + :program:`/usr/bin/open` instead of constructing and executing AppleScript | ||
| 1701 | + via :program:`osascript`. The default browser is detected from the | ||
| 1702 | + LaunchServices preferences file using :mod:`plistlib`, with | ||
| 1703 | + :class:`!com.apple.Safari` as the fallback on fresh installations. | ||
| 1704 | + For non-HTTP(S) URLs, :program:`open -b <bundle-id>` is used to route the | ||
| 1705 | + URL through a browser rather than the OS file handler, preventing | ||
| 1706 | + file injection attacks. | ||
| 1707 | + (Contributed by Jeff Lyon in :gh:`137586`.) | ||
| 1708 | + | ||
| 1709 | + | ||
| 1666 | 1710 | xml | |
| 1667 | 1711 | --- | |
| 1668 | 1712 | ||
| 1669 | 1713 | * Add the :func:`xml.is_valid_name` function, which allows to check | |
| 1670 | 1714 | whether a string can be used as an element or attribute name in XML. | |
| 1671 | 1715 | (Contributed by Serhiy Storchaka in :gh:`139489`.) | |
| 1672 | 1716 | ||
| 1717 | + * Add the :func:`xml.is_valid_text` function, which allows to check | ||
| 1718 | + whether a string can be used in the XML document. | ||
| 1719 | + (Contributed by Serhiy Storchaka in :gh:`139489`.) | ||
| 1720 | + | ||
| 1673 | 1721 | ||
| 1674 | 1722 | xml.parsers.expat | |
| 1675 | 1723 | ----------------- | |
@@ -2059,6 +2107,13 @@ New deprecations | |||
| 2059 | 2107 | (Contributed by kishorhange111 in :gh:`148849`.) | |
| 2060 | 2108 | ||
| 2061 | 2109 | ||
| 2110 | + * :mod:`imaplib`: | ||
| 2111 | + | ||
| 2112 | + * Altering :attr:`IMAP4.file <imaplib.IMAP4.file>` is now deprecated | ||
| 2113 | + and slated for removal in Python 3.19. This property is now unused | ||
| 2114 | + and changing its value does *not* explicitly close the current file. | ||
| 2115 | + | ||
| 2116 | + | ||
| 2062 | 2117 | * :mod:`re`: | |
| 2063 | 2118 | ||
| 2064 | 2119 | * :func:`re.match` and :meth:`re.Pattern.match` are now | |
@@ -2102,6 +2157,12 @@ New deprecations | |||
| 2102 | 2157 | merely imported or accessed from the :mod:`!typing` module. | |
| 2103 | 2158 | ||
| 2104 | 2159 | ||
| 2160 | + * :mod:`webbrowser`: | ||
| 2161 | + | ||
| 2162 | + * :class:`!webbrowser.MacOSXOSAScript` is deprecated in favour of | ||
| 2163 | + :class:`!webbrowser.MacOS` and scheduled for removal in Python 3.17. | ||
| 2164 | + (Contributed by Jeff Lyon in :gh:`137586`.) | ||
| 2165 | + | ||
| 2105 | 2166 | * ``__version__`` | |
| 2106 | 2167 | ||
| 2107 | 2168 | * The ``__version__``, ``version`` and ``VERSION`` attributes have been | |
@@ -2291,6 +2352,11 @@ New features | |||
| 2291 | 2352 | Python 3.14. | |
| 2292 | 2353 | (Contributed by Victor Stinner in :gh:`142417`.) | |
| 2293 | 2354 | ||
| 2355 | + * Add :c:func:`PyUnstable_DumpTraceback` and | ||
| 2356 | + :c:func:`PyUnstable_DumpTracebackThreads` functions to output Python | ||
| 2357 | + stacktraces. | ||
| 2358 | + (Contributed by Alex Malyshev in :gh:`145559`.) | ||
| 2359 | + | ||
| 2294 | 2360 | Changed C APIs | |
| 2295 | 2361 | -------------- | |
| 2296 | 2362 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,3 +11,11 @@ struct _traceback { | |||
| 11 | 11 | int tb_lasti; | |
| 12 | 12 | int tb_lineno; | |
| 13 | 13 | }; | |
| 14 | + | ||
| 15 | + PyAPI_FUNC(const char*) PyUnstable_DumpTraceback(int fd, PyThreadState *tstate); | ||
| 16 | + | ||
| 17 | + PyAPI_FUNC(const char*) PyUnstable_DumpTracebackThreads( | ||
| 18 | + int fd, | ||
| 19 | + PyInterpreterState *interp, | ||
| 20 | + PyThreadState *current_tstate, | ||
| 21 | + Py_ssize_t max_threads); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments