Commit Graph

1634 Commits

Author SHA1 Message Date
Miss Islington (bot) 2e56526412
[3.13] Doc: C API: Move `tp_dealloc` paragraph to `tp_dealloc` section (GH-125737) (#125798)
It looks like commit 43cf44ddcc
(gh-31501) accidentally moved the paragraph to the `tp_finalize`
section when the intent was to move it to the `tp_dealloc` section
(according to the commit message).

(cherry picked from commit d880c83ff7)


Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2024-10-21 09:55:36 -07:00
Miss Islington (bot) 7711a1c33f
[3.13] gh-125313: Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes (GH-125317) (#125776)
gh-125313: Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes (GH-125317)

Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes.

(cherry picked from commit 7d88140d52)

Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
2024-10-21 09:41:15 +00:00
Miss Islington (bot) 483c747939
[3.13] Doc: Fix typos (GH-125728) (#125773)
(cherry picked from commit ded105a62b)

Co-authored-by: ember91 <31469580+ember91@users.noreply.github.com>
2024-10-21 08:49:31 +00:00
Miss Islington (bot) cff627a27d
[3.13] gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384) (#125407)
gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384)
(cherry picked from commit c6d7b644c2)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-10-13 17:44:50 +00:00
Alex Waygood aa4da1e468
[3.13] gh-101100: Consolidate documentation on `ModuleType` attributes (#124709) (#125208)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-09 20:03:30 +01:00
Alyssa Coghlan 64391363ed
[3.13] bpo-34206: Improve docs and test coverage for pre-init functions (GH-8023) (#125092)
- move the Py_Main documentation from the very high level API section
  to the initialization and finalization section
- make it clear that it encapsulates a full Py_Initialize/Finalize
  cycle of its own
- point out that exactly which settings will be read and applied
  correctly when Py_Main is called after a separate runtime
  initialization call is version dependent
- be explicit that Py_IsInitialized can be called prior to
  initialization
- actually test that Py_IsInitialized can be called prior to
  initialization
- flush stdout in the embedding tests that run code so it appears
  in the expected order when running with "-vv"
- make "-vv" on the subinterpreter embedding tests less spammy

---------

(cherry picked from commit 7c4b6a68f2)

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-08 09:30:06 +00:00
Miss Islington (bot) 0e0a2dadec
[3.13] gh-70870: Clarify dual usage of 'free variable' (GH-122545) (#125088)
The term "free variable" has unfortunately become genuinely
ambiguous over the years (presumably due to the names of
some relevant code object instance attributes).

While we can't eliminate that ambiguity at this late date, we can
at least alert people to the potential ambiguity by describing
both the formal meaning of the term and the common
alternative use as a direct synonym for "closure variable".

---------

(cherry picked from commit 27390990fa)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-08 17:58:47 +10:00
Miss Islington (bot) 566983dd12
[3.13] gh-124182: Explain naming rules for struct sequence types (GH-124335) (#125057)
gh-124182: Explain naming rules for struct sequence types (GH-124335)
(cherry picked from commit 3287c834e5)

Co-authored-by: ffelixg <142172984+ffelixg@users.noreply.github.com>
2024-10-07 23:47:30 +02:00
Miss Islington (bot) bde4ae10ba
[3.13] gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` (gh-124920) (#124930)
gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` (gh-124920)
(cherry picked from commit 9eeb21bf76)

Co-authored-by: Donghee Na <donghee.na@python.org>
2024-10-03 08:54:56 -07:00
Miss Islington (bot) e8980b17bb
[3.13] gh-124385: Document and soft-deprecate PyLong_AS_LONG (GH-124386) (#124719)
gh-124385: Document and soft-deprecate PyLong_AS_LONG (GH-124386)
(cherry picked from commit 425587a110)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-09-29 17:59:54 -07:00
Miss Islington (bot) 5c5f02753a
[3.13] doc: PyUnicode_AsUTF8String() fails if string contains surrogates (GH-124605) (#124707)
doc: PyUnicode_AsUTF8String() fails if string contains surrogates (GH-124605)
(cherry picked from commit d8cf587dc7)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-27 15:20:44 -07:00
Miss Islington (bot) f6e23bb6bb
[3.13] GH-95079: document error behaviour for some unicode C APIs (GH-95080) (#124661)
GH-95079: document error behaviour for some unicode C APIs (GH-95080)
(cherry picked from commit b79a21ea42)

Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
2024-09-27 11:01:03 -07:00
Alex Waygood 9f2e6ca199
[3.13] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124556) 2024-09-25 17:29:48 -07:00
Miss Islington (bot) ed69247c44
[3.13] gh-123609: Clarify usage of standalone `PyBUF_FORMAT` (GH-123778) (#123903)
gh-123609: Clarify usage of standalone `PyBUF_FORMAT` (GH-123778)
(cherry picked from commit 962304a54c)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-09-24 11:16:12 -07:00
Miss Islington (bot) 181c2b8669
[3.13] gh-119802: Update memory management docs for free-threaded build (gh-124006) (#124054)
gh-119802: Update memory management docs for free-threaded build (gh-124006)

* gh-119802: Update memory management docs for free-threaded build

* nit

* nit

* Address code review

* nit

* Update Doc/c-api/memory.rst



---------

(cherry picked from commit e6bb1a2b28)

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-09-23 17:31:01 -07:00
Petr Viktorin a439f8531f
[3.13] gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134) (#124244)
gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134)

(cherry picked from commit 32119fc377)
2024-09-23 16:22:04 -07:00
Miss Islington (bot) 8d5911ef6b
[3.13] Use pep role instead of url (GH-121611) (#124172)
Use pep role instead of url (GH-121611)
(cherry picked from commit 33eeccf6d4)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-23 11:39:16 -07:00
Adam Turner 86f30dd539
[3.13] GH-109975: Copyedit 3.13 What's New: C API (GH-124313) (#124334)
* [3.13] GH-109975: Copyedit 3.13 What's New: C API (GH-124313)
(cherry picked from commit 9d0a75269c)

* gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-09-23 11:14:13 -07:00
Miss Islington (bot) e5568e5e9d
[3.13] Swap the and from in sentence in init_config.rst (GH-120086) (#123744)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-05 20:26:23 +00:00
Wei-Hsiang (Matt) Wang 05dcc81601
[3.13] gh-123517: Remove unnecessary `:meth:` parentheses (gh-123518) (GH-123577) 2024-09-02 16:00:04 +02:00
Wei-Hsiang (Matt) Wang 9f5f2b7128
[3.13] gh-123492: Remove unnecessary `:func:` parentheses (gh-123493) (#123513) 2024-08-30 20:14:48 +03:00
Miss Islington (bot) fbc975223b
[3.13] gh-123254: Improve `tuple` C API docs with more info about errors (GH-123255) (#123416)
gh-123254: Improve `tuple` C API docs with more info about errors (GH-123255)
(cherry picked from commit 6f563e364d)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-08-28 07:47:39 +00:00
Miss Islington (bot) 7db7fcc0ef
[3.13] GH-109975: Copyedit 3.13 What's New: Release Highlights (GH-122958) (#122971)
GH-109975: Copyedit 3.13 What's New: Release Highlights (GH-122958)
(cherry picked from commit db6f5e1933)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-08-13 15:58:35 +01:00
Sergey B Kirpichev fe65a8b0d7
[3.13] gh-122613: Document PyLong_GetInfo() (part of Limited API) (GH-122280) (#122645)
[3.13] gh-122613: Document PyLong_GetInfo() (part of Limited API) (GH-GH-122280)
(cherry picked from commit d91ac525ef)
2024-08-05 20:11:34 +02:00
Miss Islington (bot) 9697b01fae
[3.13] gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624) (#122658)
gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624)
(cherry picked from commit 151934a324)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-08-04 15:09:22 +03:00
Miss Islington (bot) 3ae1236c73
[3.13] Docs: spelling and grammar fixes (GH-122084) (#122106)
Docs: spelling and grammar fixes (GH-122084)

Corrected some grammar and spelling issues in documentation.

(cherry picked from commit bc264eac3a)

Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-22 01:30:34 +00:00
Adam Turner c12f81ed82
[3.13] GH-121970: Rewrite the C-API annotations extension (#121985) (#122027)
GH-121970: Rewrite the C-API annotations extension (#121985)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
(cherry picked from commit 22c9d9c1fc)
2024-07-19 13:03:52 +00:00
Serhiy Storchaka a45d9051ed
[3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012)
(cherry picked from commit 1a0c7b9ba4)
2024-07-19 09:13:08 +00:00
Petr Viktorin 4395d68c70
[3.13] gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364) (GH-121854)
* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs

* Document immortality in some functions that take `const char *`

This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.

Always point out a non-immortalizing alternative.

* Don't immortalize user-provided attr names in _ctypes
(cherry picked from commit b4aedb23ae)
2024-07-17 14:51:42 +02:00
Miss Islington (bot) bcf1c7004d
[3.13] gh-121834: Improve `complex` C-API docs (GH-121835) (#121895)
gh-121834: Improve `complex` C-API docs (GH-121835)
(cherry picked from commit 72dccd6073)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-17 07:25:07 +00:00
Miss Islington (bot) e64a9db73d
[3.13] gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626) (gh-121827)
gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626)
(cherry picked from commit 2bac2b86b1)

Co-authored-by: Donghee Na <donghee.na@python.org>
2024-07-16 14:32:31 +00:00
Miss Islington (bot) f672ee2242
[3.13] gh-121749: Fix discrepancy in docs for `PyModule_AddObjectRef` (GH-121750) (GH-121752)
(cherry picked from commit 26dfb27712)

Co-authored-by: Dominic H <dom@dominic.sk>
2024-07-14 12:31:46 +02:00
Miss Islington (bot) 261c8e9d47
[3.13] gh-121615: Improve `module.rst` C-API docs with better error descriptions (GH-121616) (#121618)
gh-121615: Improve `module.rst` C-API docs with better error descriptions (GH-121616)
(cherry picked from commit e6264b44dc)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-11 09:15:18 +00:00
Miss Islington (bot) 8c4728f6af
[3.13] gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568) (#121578)
gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568)
(cherry picked from commit 84a5597b08)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-10 11:13:40 +00:00
Miss Islington (bot) 8d473d8e57
[3.13] gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534) (#121539)
gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534)
(cherry picked from commit 649d5b6d7b)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-09 16:06:46 +00:00
Miss Islington (bot) aae49ec595
[3.13] [docs] fix a Sphinx directive in `c-api/object.rst` (GH-121430) (#121440)
[docs] fix a Sphinx directive in `c-api/object.rst` (GH-121430)
(cherry picked from commit ada964fba0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-06 18:13:57 +00:00
Miss Islington (bot) ee1db25bc0
[3.13] docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237) (#121309)
docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237)
(cherry picked from commit 4232976b02)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2024-07-03 08:23:51 +00:00
Miss Islington (bot) 58a3c3c0ad
gh-121115: Skip __index__ in PyLong_AsNativeBytes by default (GH-121118)
(cherry picked from commit 2894aa14f2)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-06-28 15:52:26 +00:00
Miss Islington (bot) 0a77058b79
[3.13] gh-120858: PyDict_Next should not lock the dict (GH-120859) (#120964)
PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.
(cherry picked from commit 375b723d58)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-06-24 18:41:19 +00:00
Sam Gross 4dc27bc0b7
[3.13] gh-119344: Make critical section API public (GH-119353) (#120856)
This makes the following macros public as part of the non-limited C-API for
locking a single object or two objects at once.

* `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()`
* `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()`

The supporting functions and structs used by the macros are also exposed for
cases where C macros are not available.
(cherry picked from commit 8f17d69b7b)
2024-06-21 20:20:41 +00:00
Miss Islington (bot) e748805f2a
[3.13] gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120852)
(cherry picked from commit 03fa2df927, AKA gh-120839)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-21 19:21:47 +00:00
Sam Gross 3cb6c4cd60
[3.13] gh-117511: Make PyMutex public in the non-limited API (GH-117731) (#120800)
(cherry picked from commit 3af7263037)
2024-06-20 16:00:25 +00:00
Mark Shannon b8fd80f91b
[3.13] GH-119462: Enforce invariants of type versioning. Backport of GH-120731. (#120748)
* Remove uses of Py_TPFLAGS_VALID_VERSION_TAG
2024-06-20 15:09:32 +01:00
Miss Islington (bot) 1ce5984961
[3.13] gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (GH-118807) (#120695)
This exposes `PyUnstable_Object_ClearWeakRefsNoCallbacks` as an unstable
C-API function to provide a thread-safe mechanism for clearing weakrefs
without executing callbacks.

Some C-API extensions need to clear weakrefs without calling callbacks,
such as after running finalizers like we do in subtype_dealloc.
Previously they could use `_PyWeakref_ClearRef` on each weakref, but
that's not thread-safe in the free-threaded build.

(cherry picked from commit e8752d7b80)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-18 14:54:51 +00:00
Miss Islington (bot) 1177897551
[3.13] gh-111389: Add PyHASH_MULTIPLIER constant (GH-119214) (#119334)
gh-111389: Add PyHASH_MULTIPLIER constant (GH-119214)
(cherry picked from commit f6da790122)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-04 09:26:25 +02:00
Miss Islington (bot) 6db1eb98a4
[3.13] gh-119968: Improved monitoring c-api docs (GH-119969) (#119971)
gh-119968: Improved monitoring c-api docs (GH-119969)
(cherry picked from commit cae4c80714)

Co-authored-by: Awbert <119314310+SweetyAngel@users.noreply.github.com>
2024-06-03 09:49:14 +00:00
Miss Islington (bot) cf8f292a36
[3.13] gh-118934: Fix PyEval_GetLocals docs (PEP 667) (GH-119934)
PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)
(cherry picked from commit fd6cd621e0)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-02 05:57:17 +00:00
Miss Islington (bot) 36ca00f44d
[3.13] gh-118888: Further PEP 667 docs updates (gh-119894)
* Clarify impact on default behaviour of exec, eval, etc
* Update documentation for changes to PyEval_GetLocals (gh-74929)

Closes gh-118888
(cherry picked from commit 2180991ea3)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-02 15:41:25 +10:00
Miss Islington (bot) 0a266f7e74
[3.13] gh-74929: PEP 667 C API documentation (gh-119892)
* Add docs for new APIs
* Add soft-deprecation notices
* Add What's New porting entries
* Update comments referencing `PyFrame_LocalsToFast()` to mention the proxy instead
* Other related cleanups found when looking for refs to the deprecated APIs

(cherry picked from commit 3859e09e3d)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-01 04:23:04 +00:00
Miss Islington (bot) f1302c1e47
[3.13] gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475) (#119602)
gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475)
(cherry picked from commit 3b26cd8ca0)

Co-authored-by: Aditya Borikar <adityaborikar2@gmail.com>
2024-05-27 12:34:13 +00:00