Restore the global Input Stream pointer after trying to match a sub-pattern.
.
(cherry picked from commit abd9cc52d9)
Co-authored-by: SKO <41810398+uyw4687@users.noreply.github.com>
* gh-91051: fix segfault when using all 8 type watchers (GH-107853)
(cherry picked from commit 66e4edd734)
Co-authored-by: Carl Meyer <carl@oddbird.net>
gh-107963: Fix set_forkserver_preload to check the type of given list (GH-107965)
(cherry picked from commit 6515ec3d3d)
gh-107963: Fix set_forkserver_preload to check the type of given list
Co-authored-by: Dong-hee Na <donghee.na@python.org>
Add another example to the statistics docs (GH-107904)
(cherry picked from commit 2b6dc2accc)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
gh-91054: make code watcher tests resilient to other watchers (GH-107821)
(cherry picked from commit 2ec16fed14)
Co-authored-by: Carl Meyer <carl@oddbird.net>
GH-107724: Fix the signature of `PY_THROW` callback functions. (GH-107725)
(cherry picked from commit 52fbcf61b5)
Co-authored-by: Mark Shannon <mark@hotpy.org>
gh-107814: Avoid output from Nuget installation in find_python.bat (GH-107815)
(cherry picked from commit 1e229e2c3d)
Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
[3.12] gh-106052: Fix bug in the matching of possessive quantifiers (gh-106515)
It did not work in the case of a subpattern containing backtracking.
Temporary implement possessive quantifiers as equivalent greedy qualifiers
in atomic groups..
(cherry picked from commit 7b6e34e5ba)
* gh-98154: Clarify Usage of "Reference Count" In the Docs (gh-107552)
PEP 683 (immortal objects) revealed some ways in which the Python documentation has been unnecessarily coupled to the implementation details of reference counts. In the end users should focus on reference ownership, including taking references and releasing them, rather than on how many reference counts an object has.
This change updates the documentation to reflect that perspective. It also updates the docs relative to immortal objects in a handful of places.
(cherry picked from commit 5dc825d504)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* Fix a typo.
---------
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-107442: Document all valid types for ctypes _as_parameter_ (GH-107443)
(cherry picked from commit 6925c578a0)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Docs: Argument Clinic: Move the CConverter class to the reference (GH-107671)
(cherry picked from commit a6675b1a59)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Improve cross-references in `runpy` docs (GH-107673)
- Add links to `__main__` and `sys.path` where appropriate
- Ensure each paragraph never has more than one link to the same thing, to avoid visual clutter from too many links
(cherry picked from commit 4e242d1ffb)
Co-authored-by: Kamil Turek <kamil.turek@hotmail.com>
Do not use deprecated ``logger.warn()`` in pyspecific (GH-107694)
(cherry picked from commit 9564e31cbc)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs: skip python-docs-theme 2023.7 to fix mobile menu (GH-107666)
(cherry picked from commit 9641c4d8e2)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-107662: Switch 'any' and 'anext' in functions.rst (GH-107663)
Order was reversed in index at top, not in body.
(cherry picked from commit 9ebc6ecbc3)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-107432 Fix incorrect indentation in annotations HOWTO (GH-107445)
gh-107432 Fix incorrect indentation in annotations document
Body text in https://docs.python.org/3/howto/annotations.html was
indented throughout, and was being rendered in blockquote elements.
(cherry picked from commit 5e2746d6e2)
Co-authored-by: Daniele Procida <daniele@vurt.org>
Docs: Only include Plausible for html, not for epub etc (GH-107637)
Only include Plausible for html, not for epub etc
(cherry picked from commit 904b5319b3)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Update the expected bytecode magic in test_importlib.test_util to the final
3.12 magic number. From now on it's not allowed to change for any 3.12
release.
GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535)
* Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
(cherry picked from commit fa45958450)
Co-authored-by: Mark Shannon <mark@hotpy.org>
gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567)
The linked list of objects was a global variable, which broke isolation between interpreters, causing crashes. To solve this, we've moved the linked list to each interpreter.
(cherry picked from commit 58ef741867)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-107576: Ensure `__orig_bases__` are our own in `get_original_bases` (GH-107584)
(cherry picked from commit ed4a978449)
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Co-authored-by: Chris Bouchard <chris@upliftinglemma.net>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-107471: Fix Refleaks in test_import (gh-107569)
gh-107184 introduced a refleak in test_import.SubinterpImportTests (specifically test_singlephase_check_with_setting_and_override and test_single_init_extension_compat). We fix it here by making sure _testsinglephase is removed from sys.modules whenever we clear the runtime's internal state for the module.
The underlying problem is strictly contained in the internal function _PyImport_ClearExtension() (AKA _testinternalcapi.clear_extension()), which is only used in tests.
(This also fixes an intermittent segfault introduced in the same place, in test_disallowed_reimport.)
(cherry picked from commit 017f047183)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Clarify `Self` interaction with subclasses (GH-107511)
(cherry picked from commit c8872f4285)
Co-authored-by: Alexandru Mărășteanu <alexei@users.noreply.github.com>
gh-106092: Fix use-after-free crash in frame_dealloc (GH-106875)
It was possible for the trashcan to delay the deallocation of a
PyFrameObject until after its corresponding _PyInterpreterFrame has
already been freed. So frame_dealloc needs to avoid dereferencing the
f_frame pointer unless it first checks that the pointer still points
to the interpreter frame within the frame object.
(cherry picked from commit 557b05c7a5)
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Co-authored-by: Anders Kaseorg <andersk@mit.edu>
gh-105766: Document that Custom Allocators Must Be Thread-Safe (gh-107519)
(cherry picked from commit db361a340a)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-99113: Add a What's New Entry for PEP 684 (gh-107520)
(cherry picked from commit 79e479c45f)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (GH-107403)
It was added in 3.12 for PEP 684 (per-interpreter GIL).
(cherry picked from commit fb344e99aa)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Summarise the goals of Argument Clinic in a single sentence.
Mention that Argument Clinic was introduced with PEP-436.
(cherry picked from commit abb71c6a8f)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
gh-105578: Add more usage examples to `typing.AnyStr` docs (GH-107045)
``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32b87)
Co-authored-by: Michael The <michael-the1@users.noreply.github.com>